Guard

Trait Guard 

Source
pub trait Guard {
    // Required methods
    fn into_inner_if(
        self,
        pred: impl Fn(&UserKey) -> bool,
    ) -> Result<(UserKey, Option<UserValue>)>;
    fn into_inner(self) -> Result<KvPair>;
    fn key(self) -> Result<UserKey>;
    fn size(self) -> Result<u32>;

    // Provided method
    fn value(self) -> Result<UserValue>
       where Self: Sized { ... }
}
Expand description

Guard to access key-value pairs

Required Methods§

Source

fn into_inner_if( self, pred: impl Fn(&UserKey) -> bool, ) -> Result<(UserKey, Option<UserValue>)>

Accesses the key-value pair if the predicate returns true.

The predicate receives the key - if returning false, the value may not be loaded if the tree is key-value separated.

§Errors

Will return Err if an IO error occurs.

Source

fn into_inner(self) -> Result<KvPair>

Accesses the key-value pair.

§Errors

Will return Err if an IO error occurs.

Source

fn key(self) -> Result<UserKey>

Accesses the key.

§Errors

Will return Err if an IO error occurs.

Source

fn size(self) -> Result<u32>

Returns the value size.

§Errors

Will return Err if an IO error occurs.

Provided Methods§

Source

fn value(self) -> Result<UserValue>
where Self: Sized,

Accesses the value.

§Errors

Will return Err if an IO error occurs.

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§