[−][src]Struct exonum_merkledb::IndexBuilder
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]
T: IndexAccess,
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]
I: BinaryKey,
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]
V: BinaryAttribute + Default + Copy,
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]
V: BinaryAttribute + Default + Copy,
Similar to build
, but returns None
if index has not been created yet.
Trait Implementations
Auto Trait Implementations
impl<T> Sync for IndexBuilder<T> where
T: Sync,
T: Sync,
impl<T> Send for IndexBuilder<T> where
T: Send,
T: Send,
impl<T> Unpin for IndexBuilder<T> where
T: Unpin,
T: Unpin,
impl<T> RefUnwindSafe for IndexBuilder<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> UnwindSafe for IndexBuilder<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,