Struct bonsaidb_core::keyvalue::namespaced::Namespaced
source · [−]pub struct Namespaced<'a, K> { /* private fields */ }Expand description
A namespaced key-value store. All operations performed with this will be separate from other namespaces.
Trait Implementations
sourceimpl<'a, K> KeyValue for Namespaced<'a, K> where
K: KeyValue,
impl<'a, K> KeyValue for Namespaced<'a, K> where
K: KeyValue,
sourcefn execute_key_operation<'life0, 'async_trait>(
&'life0 self,
op: KeyOperation
) -> Pin<Box<dyn Future<Output = Result<Output, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn execute_key_operation<'life0, 'async_trait>(
&'life0 self,
op: KeyOperation
) -> Pin<Box<dyn Future<Output = Result<Output, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Executes a single KeyOperation.
sourcefn key_namespace(&self) -> Option<&str>
fn key_namespace(&self) -> Option<&str>
The current namespace.
sourcefn with_key_namespace(&self, namespace: &str) -> Namespaced<'_, Self> where
Self: Sized,
fn with_key_namespace(&self, namespace: &str) -> Namespaced<'_, Self> where
Self: Sized,
Access this Key-Value store within a namespace. When using the returned
Namespaced instance, all keys specified will be separated into their
own storage designated by namespace. Read more
sourcefn set_key<'a, S: Into<String>, V: Serialize + Send + Sync>(
&'a self,
key: S,
value: &'a V
) -> Builder<'a, Self, V>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
fn set_key<'a, S: Into<String>, V: Serialize + Send + Sync>(
&'a self,
key: S,
value: &'a V
) -> Builder<'a, Self, V>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
Sets key to value. This function returns a builder that is also a
Future. Awaiting the builder will execute Command::Set with the options
given. Read more
sourcefn set_binary_key<'a, S: Into<String>>(
&'a self,
key: S,
bytes: &'a [u8]
) -> Builder<'a, Self, ()>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
fn set_binary_key<'a, S: Into<String>>(
&'a self,
key: S,
bytes: &'a [u8]
) -> Builder<'a, Self, ()>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
Sets key to bytes. This function returns a builder that is also
a Future. Awaiting the builder will execute Command::Set with
the options given. Read more
sourcefn set_numeric_key<S: Into<String>, V: Into<Numeric>>(
&self,
key: S,
value: V
) -> Builder<'_, Self, ()>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
fn set_numeric_key<S: Into<String>, V: Into<Numeric>>(
&self,
key: S,
value: V
) -> Builder<'_, Self, ()>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
K: KeyValue,
V: Serialize + Send + Sync, type Output = Result<KeyStatus, Error>;
Sets key to value. This stores the value as a Numeric,
enabling atomic math operations to be performed on this key. This
function returns a builder that is also a Future. Awaiting the
builder will execute Command::Set with the options given. Read more
sourcefn increment_key_by<S: Into<String> + Send + Sync, V: Into<Numeric> + TryFrom<Numeric, Error = IncompatibleTypeError> + Send + Sync>(
&self,
key: S,
value: V
) -> Builder<'_, Self, V>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: TryFrom<Numeric, Error = IncompatibleTypeError>, type Output = Result<V, Error>;
fn increment_key_by<S: Into<String> + Send + Sync, V: Into<Numeric> + TryFrom<Numeric, Error = IncompatibleTypeError> + Send + Sync>(
&self,
key: S,
value: V
) -> Builder<'_, Self, V>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: TryFrom<Numeric, Error = IncompatibleTypeError>, type Output = Result<V, Error>;
K: KeyValue,
V: TryFrom<Numeric, Error = IncompatibleTypeError>, type Output = Result<V, Error>;
Increments key by value. The value stored must be a Numeric,
otherwise an error will be returned. The result of the increment
will be the value’s type. For example, if the stored value is
currently a u64, but value is a f64, the current value will be
converted to an f64, and the stored value will be an f64. Read more
sourcefn decrement_key_by<S: Into<String> + Send + Sync, V: Into<Numeric> + TryFrom<Numeric, Error = IncompatibleTypeError> + Send + Sync>(
&self,
key: S,
value: V
) -> Builder<'_, Self, V>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: TryFrom<Numeric, Error = IncompatibleTypeError>, type Output = Result<V, Error>;
fn decrement_key_by<S: Into<String> + Send + Sync, V: Into<Numeric> + TryFrom<Numeric, Error = IncompatibleTypeError> + Send + Sync>(
&self,
key: S,
value: V
) -> Builder<'_, Self, V>ⓘNotable traits for Builder<'a, K, V>impl<'a, K, V> Future for Builder<'a, K, V> where
K: KeyValue,
V: TryFrom<Numeric, Error = IncompatibleTypeError>, type Output = Result<V, Error>;
K: KeyValue,
V: TryFrom<Numeric, Error = IncompatibleTypeError>, type Output = Result<V, Error>;
Decrements key by value. The value stored must be a Numeric,
otherwise an error will be returned. The result of the decrement
will be the value’s type. For example, if the stored value is
currently a u64, but value is a f64, the current value will be
converted to an f64, and the stored value will be an f64. Read more
sourcefn get_key<S: Into<String>>(&self, key: S) -> Builder<'_, Self>ⓘNotable traits for Builder<'a, K>impl<'a, K> Future for Builder<'a, K> where
K: KeyValue, type Output = Result<Option<Value>, Error>;
fn get_key<S: Into<String>>(&self, key: S) -> Builder<'_, Self>ⓘNotable traits for Builder<'a, K>impl<'a, K> Future for Builder<'a, K> where
K: KeyValue, type Output = Result<Option<Value>, Error>;
K: KeyValue, type Output = Result<Option<Value>, Error>;
Gets the value stored at key. This function returns a builder that is also a
Future. Awaiting the builder will execute Command::Get with the options
given. Read more
Auto Trait Implementations
impl<'a, K> RefUnwindSafe for Namespaced<'a, K> where
K: RefUnwindSafe,
impl<'a, K> Send for Namespaced<'a, K> where
K: Sync,
impl<'a, K> Sync for Namespaced<'a, K> where
K: Sync,
impl<'a, K> Unpin for Namespaced<'a, K>
impl<'a, K> UnwindSafe for Namespaced<'a, K> where
K: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more