Trait gear_common::storage::Limiter

source ·
pub trait Limiter {
    type Value;

    // Required methods
    fn decrease(value: Self::Value);
    fn get() -> Self::Value;
    fn put(value: Self::Value);
}
Expand description

Represents logic of limiting value decreasing.

Required Associated Types§

source

type Value

Limiter stored type.

Required Methods§

source

fn decrease(value: Self::Value)

Decreases stored value.

Should be safe from overflow.

source

fn get() -> Self::Value

Returns stored value, if present, or default/nullable value.

source

fn put(value: Self::Value)

Puts given value into stored, to start from new one for future decreasing.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<VS: ValueStorage<Value = i8>> Limiter for LimiterImpl<i8, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = i16>> Limiter for LimiterImpl<i16, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = i32>> Limiter for LimiterImpl<i32, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = i64>> Limiter for LimiterImpl<i64, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = i128>> Limiter for LimiterImpl<i128, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = u8>> Limiter for LimiterImpl<u8, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = u16>> Limiter for LimiterImpl<u16, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = u32>> Limiter for LimiterImpl<u32, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = u64>> Limiter for LimiterImpl<u64, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = u128>> Limiter for LimiterImpl<u128, VS>

§

type Value = <VS as ValueStorage>::Value