CountedByKey

Trait CountedByKey 

Source
pub trait CountedByKey {
    type Key;
    type Length: Default + PartialEq;

    // Required method
    fn len(key: &Self::Key) -> Self::Length;

    // Provided method
    fn is_empty(key: &Self::Key) -> bool { ... }
}
Expand description

Represents default counting logic, by providing ability to return length of the object as specified (associated) type or answer the question is the object empty, by provided key of specified (associated) type.

Should be implemented on double map based types.

Required Associated Types§

Source

type Key

Key type of counting target.

Source

type Length: Default + PartialEq

Returning length type.

Required Methods§

Source

fn len(key: &Self::Key) -> Self::Length

Returns current Self’s amount of elements as Length type.

Provided Methods§

Source

fn is_empty(key: &Self::Key) -> bool

Returns bool, defining if Self doesn’t contain elements.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T, Task, Error, OutputError, Callbacks> CountedByKey for TaskPoolImpl<T, Task, Error, OutputError, Callbacks>
where T: DoubleMapStorage<Key2 = Task, Value = ()> + CountedByKey<Key = T::Key1>, Error: TaskPoolError, OutputError: From<Error>, Callbacks: TaskPoolCallbacks,

Source§

impl<T, Value, BlockNumber, Error, OutputError, Callbacks, KeyGen> CountedByKey for MailboxImpl<T, Value, BlockNumber, Error, OutputError, Callbacks, KeyGen>
where T: DoubleMapStorage<Value = (Value, Interval<BlockNumber>)> + CountedByKey<Key = T::Key1>, Error: MailboxError, OutputError: From<Error>, Callbacks: MailboxCallbacks<OutputError, Value = Value, BlockNumber = BlockNumber>, KeyGen: KeyFor<Key = (T::Key1, T::Key2), Value = Value>,

Source§

impl<T, Value, BlockNumber, Error, OutputError, Callbacks, KeyGen> CountedByKey for WaitlistImpl<T, Value, BlockNumber, Error, OutputError, Callbacks, KeyGen>
where T: DoubleMapStorage<Value = (Value, Interval<BlockNumber>)> + CountedByKey<Key = T::Key1>, Error: WaitlistError, OutputError: From<Error>, Callbacks: WaitlistCallbacks<Value = Value, BlockNumber = BlockNumber>, KeyGen: KeyFor<Key = (T::Key1, T::Key2), Value = Value>,

Source§

impl<T: AuxiliaryDoubleStorageWrap> CountedByKey for T

Available on crate feature std only.