Struct exonum::storage::base_index::BaseIndex [] [src]

pub struct BaseIndex<T> { /* fields omitted */ }

Basic struct for all indices that implements common features.

This structure is not intended for direct use, rather it is the basis for building other types of indices.

BaseIndex requires that the keys implement the StorageKey trait and the values implement StorageValue trait. However, this structure is not bound to specific types and allows the use of any types as keys or values.

Methods

impl<T> BaseIndex<T>
[src]

Creates a new index representation based on the common prefix of its keys and storage view.

Storage view can be specified as &Snapshot or &mut Fork. In the first case only immutable methods are available. In the second case both immutable and mutable methods are available.

impl<T> BaseIndex<T> where
    T: AsRef<Snapshot>, 
[src]

Returns a value of any type corresponding to the key of any type.

Returns true if the index contains a value of any type for the specified key of any type.

Returns an iterator over the entries of the index in ascending order. The iterator element type is any key-value pair. An argument subprefix allows to specify a subset of keys for iteration.

Returns an iterator over the entries of the index in ascending order starting from the specified key. The iterator element type is any key-value pair. An argument subprefix allows to specify a subset of iteration.

impl<'a> BaseIndex<&'a mut Fork>
[src]

Inserts the key-value pair into the index. Both key and value may be of any types.

Removes the key of any type from the index.

Clears the index, removing all entries.

Notes

Currently this method is not optimized to delete large set of data. During the execution of this method the amount of allocated memory is linearly dependent on the number of elements in the index.

Trait Implementations

impl<T: Debug> Debug for BaseIndex<T>
[src]

Formats the value using the given formatter.