[][src]Struct exonum_merkledb::access::Prefixed

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

Access that prepends the specified prefix to each created view. The prefix is separated from user-provided names with a dot char '.'.

Since the prefix itself cannot contain a dot, Prefixed accesses provide namespace separation. A set of indexes to which Prefixed provides access does not intersect with a set of indexes accessed by a Prefixed instance with another prefix. Additionally, index in Prefixed accesses do not intersect with indexes in special-purpose Access implementations (Migrations and Scratchpads).

Examples

use exonum_merkledb::{access::{AccessExt, CopyAccessExt, Prefixed}, Database, TemporaryDB};

let db = TemporaryDB::new();
let fork = db.fork();
let prefixed = Prefixed::new("prefixed", &fork);
prefixed.get_list("list").extend(vec![1_u32, 2, 3]);
let same_list = fork.get_list::<_, u32>("prefixed.list");
assert_eq!(same_list.len(), 3);

Methods

impl<T: RawAccess> Prefixed<T>[src]

pub fn new(prefix: impl Into<String>, access: T) -> Self[src]

Creates a new prefixed access.

Panics

Trait Implementations

impl<T: RawAccess> Access for Prefixed<T>[src]

type Base = T

Raw access serving as the basis for created indexes.

impl<T: Clone> Clone for Prefixed<T>[src]

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

impl<T: RawAccess> From<Prefixed<T>> for GenericAccess<T>[src]

impl<'a, T> IntoErased<'a> for Prefixed<T> where
    T: Into<GenericRawAccess<'a>>, 
[src]

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

impl<T> Access for T where
    T: RawAccess
[src]

type Base = T

Raw access serving as the basis for created indexes.

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

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,