Trait frame_support::storage::StorageList

source ·
pub trait StorageList<V: FullCodec> {
    type Iterator: Iterator<Item = V>;
    type Appender: StorageAppender<V>;

    // Required methods
    fn iter() -> Self::Iterator;
    fn drain() -> Self::Iterator;
    fn appender() -> Self::Appender;

    // Provided methods
    fn append_one<EncodeLikeValue>(item: EncodeLikeValue)
       where EncodeLikeValue: EncodeLike<V> { ... }
    fn append_many<EncodeLikeValue, I>(items: I)
       where EncodeLikeValue: EncodeLike<V>,
             I: IntoIterator<Item = EncodeLikeValue> { ... }
}
Expand description

A non-continuous container type.

Required Associated Types§

source

type Iterator: Iterator<Item = V>

Iterator for normal and draining iteration.

source

type Appender: StorageAppender<V>

Append iterator for fast append operations.

Required Methods§

source

fn iter() -> Self::Iterator

List the elements in append order.

source

fn drain() -> Self::Iterator

Drain the elements in append order.

Note that this drains a value as soon as it is being inspected. For example take_while(|_| false) still drains the first element. This also applies to peek().

source

fn appender() -> Self::Appender

A fast append iterator.

Provided Methods§

source

fn append_one<EncodeLikeValue>(item: EncodeLikeValue)
where EncodeLikeValue: EncodeLike<V>,

Append a single element.

Should not be called repeatedly; use append_many instead. Worst case linear O(len) with len being the number if elements in the list.

source

fn append_many<EncodeLikeValue, I>(items: I)
where EncodeLikeValue: EncodeLike<V>, I: IntoIterator<Item = EncodeLikeValue>,

Append many elements.

Should not be called repeatedly; use appender instead. Worst case linear O(len + items.count()) with len beings the number if elements in the list.

Object Safety§

This trait is not object safe.

Implementors§