referrerpolicy=no-referrer-when-downgrade
frame_support::storage

Trait 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.

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§

impl<Prefix, Value, ValuesPerNewPage> StorageList<Value> for StoragePagedList<Prefix, Value, ValuesPerNewPage>
where Prefix: StorageInstance, Value: FullCodec, ValuesPerNewPage: Get<u32>,

impl<T: Config<I>, I: 'static> StorageList<<T as Config<I>>::Value> for Pallet<T, I>