Trait gear_common::storage::Counter

source ·
pub trait Counter {
    type Value;

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

Represents logic of managing step-by-step changeable value.

Required Associated Types§

source

type Value

Counter stored type.

Required Methods§

source

fn decrease()

Decreases stored value.

Should be safe from overflow.

source

fn get() -> Self::Value

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

source

fn increase()

Increases stored value.

Should be safe from overflow.

source

fn reset()

Resets stored value by setting default/starting value.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<VS: ValueStorage<Value = i8>> Counter for CounterImpl<i8, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = i16>> Counter for CounterImpl<i16, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = i32>> Counter for CounterImpl<i32, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = i64>> Counter for CounterImpl<i64, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = i128>> Counter for CounterImpl<i128, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = u8>> Counter for CounterImpl<u8, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = u16>> Counter for CounterImpl<u16, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = u32>> Counter for CounterImpl<u32, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = u64>> Counter for CounterImpl<u64, VS>

§

type Value = <VS as ValueStorage>::Value

source§

impl<VS: ValueStorage<Value = u128>> Counter for CounterImpl<u128, VS>

§

type Value = <VS as ValueStorage>::Value