[][src]Struct kv::Bucket

pub struct Bucket<'a, K: Key<'a>, V: Value>(_, _, _, _);

Provides typed access to the key/value store

Implementations

impl<'a, K: Key<'a>, V: Value> Bucket<'a, K, V>[src]

pub fn contains<X: Into<K>>(&'a self, key: X) -> Result<bool, Error>[src]

Returns true if the bucket contains the given key

pub fn get<X: Into<K>>(&'a self, key: X) -> Result<Option<V>, Error>[src]

Get the value associated with the specified key

pub fn set<X: Into<K>, Y: Into<V>>(&self, key: X, value: Y) -> Result<(), Error>[src]

Set the value associated with the specified key to the provided value

pub fn remove<X: Into<K>>(&self, key: X) -> Result<(), Error>[src]

Remove the value associated with the specified key from the database

pub fn iter(&self) -> Iter<K, V>

Notable traits for Iter<K, V>

impl<'a, K, V> Iterator for Iter<K, V> where
    K: Key<'a>,
    V: Value
type Item = Result<Item<K, V>, Error>;
[src]

Get an iterator over keys/values

pub fn iter_range<X: Into<K>>(&self, a: X, b: X) -> Iter<K, V>

Notable traits for Iter<K, V>

impl<'a, K, V> Iterator for Iter<K, V> where
    K: Key<'a>,
    V: Value
type Item = Result<Item<K, V>, Error>;
[src]

Get an iterator over keys/values in the specified range

pub fn iter_prefix<X: Into<K>>(&self, a: X) -> Iter<K, V>

Notable traits for Iter<K, V>

impl<'a, K, V> Iterator for Iter<K, V> where
    K: Key<'a>,
    V: Value
type Item = Result<Item<K, V>, Error>;
[src]

Iterate over keys/values with the specified prefix

pub fn batch(&self, batch: Batch<K, V>) -> Result<(), Error>[src]

Apply batch update

pub fn watch_prefix<X: Into<K>>(&self, prefix: X) -> Result<Watch<K, V>, Error>[src]

Get updates when a key with the given prefix is changed

pub fn transaction<A, E: From<Error>, F: Fn(Transaction<'_, '_, K, V>) -> Result<A, TransactionError<E>>>(
    &self,
    f: F
) -> Result<A, E>
[src]

Execute a transaction

pub fn prev_key<X: Into<K>>(&self, key: X) -> Result<Option<Item<K, V>>, Error>[src]

Get previous key and value in order, if one exists

pub fn next_key<X: Into<K>>(&self, key: X) -> Result<Option<Item<K, V>>, Error>[src]

Get next key and value in order, if one exists

pub fn flush(&self) -> Result<usize, Error>[src]

Flush to disk

pub async fn flush_async<'_>(&'_ self) -> Result<usize, Error>[src]

Flush to disk

pub fn pop_back(&self) -> Result<Option<Item<K, V>>, Error>[src]

Pop the last item

pub fn pop_front(&self) -> Result<Option<Item<K, V>>, Error>[src]

Pop the first item

pub fn len(&self) -> usize[src]

Get the number of items

pub fn is_empty(&self) -> bool[src]

Returns true when there are no items

pub fn clear(&self) -> Result<(), Error>[src]

Remove all items

pub fn checksum(&self) -> Result<u32, Error>[src]

CRC32 checksum of all keys and values

Trait Implementations

impl<'a, K: Clone + Key<'a>, V: Clone + Value> Clone for Bucket<'a, K, V>[src]

Auto Trait Implementations

impl<'a, K, V> !RefUnwindSafe for Bucket<'a, K, V>

impl<'a, K, V> Send for Bucket<'a, K, V> where
    K: Send,
    V: Send

impl<'a, K, V> Sync for Bucket<'a, K, V> where
    K: Sync,
    V: Sync

impl<'a, K, V> Unpin for Bucket<'a, K, V> where
    K: Unpin,
    V: Unpin

impl<'a, K, V> !UnwindSafe for Bucket<'a, K, V>

Blanket Implementations

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.