[−][src]Struct kv::Bucket
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>ⓘ
[src]
Get an iterator over keys/values
pub fn iter_range<X: Into<K>>(&self, a: X, b: X) -> Iter<K, V>ⓘ
[src]
Get an iterator over keys/values in the specified range
pub fn iter_prefix<X: Into<K>>(&self, a: X) -> Iter<K, V>ⓘ
[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]
&self,
f: F
) -> Result<A, E>
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
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,
K: Send,
V: Send,
impl<'a, K, V> Sync for Bucket<'a, K, V> where
K: Sync,
V: Sync,
K: Sync,
V: Sync,
impl<'a, K, V> Unpin for Bucket<'a, K, V> where
K: Unpin,
V: Unpin,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,