[][src]Struct exonum_merkledb::IndexBuilder

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

Struct responsible for creating view and state for index with specified address. View contains changes, state contains metadata.

Example

use exonum_merkledb::{Database, TemporaryDB, IndexBuilder, ListIndex};

let db: Box<Database> = Box::new(TemporaryDB::new());
let fork = db.fork();
{
    let (view, _state) = IndexBuilder::new(&fork)
        .index_name("index")
        .build::<()>();
}

Methods

impl<T> IndexBuilder<T> where
    T: IndexAccess
[src]

pub fn new(index_access: T) -> Self[src]

Creates a new index based on provided `index_access'.

pub fn from_address<I: Into<IndexAddress>>(address: I, index_access: T) -> Self[src]

Creates a new index from provided address.

pub fn index_name<S: Into<String>>(self, index_name: S) -> Self[src]

Provides first part of the index address.

pub fn family_id<I: ?Sized>(self, family_id: &I) -> Self where
    I: BinaryKey
[src]

Provides family_id for the index address.

pub fn index_type(self, index_type: IndexType) -> Self[src]

Sets the type of the given index.

pub fn build<V>(self) -> (View<T>, IndexState<T, V>) where
    V: BinaryAttribute + Default + Copy
[src]

Returns index based on specified view and address. Allowable characters in index name: ASCII characters, digits, underscores and dashes.

Panics

  • If index name is empty or invalid.
  • If index metadata doesn't match expected.

pub fn build_existed<V>(self) -> Option<(View<T>, IndexState<T, V>)> where
    V: BinaryAttribute + Default + Copy
[src]

Similar to build, but returns None if index has not been created yet.

Trait Implementations

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

Auto Trait Implementations

impl<T> Sync for IndexBuilder<T> where
    T: Sync

impl<T> Send for IndexBuilder<T> where
    T: Send

impl<T> Unpin for IndexBuilder<T> where
    T: Unpin

impl<T> RefUnwindSafe for IndexBuilder<T> where
    T: RefUnwindSafe

impl<T> UnwindSafe for IndexBuilder<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,