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§
source§impl<'a, K> AsyncKeyValue for Namespaced<'a, K>where
K: AsyncKeyValue,
impl<'a, K> AsyncKeyValue for Namespaced<'a, K>where
K: AsyncKeyValue,
source§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,
Namespaced<'a, K>: '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,
Namespaced<'a, K>: 'async_trait,
Executes a single
KeyOperation
.source§fn key_namespace(&self) -> Option<&str>
fn key_namespace(&self) -> Option<&str>
The current namespace.
source§fn with_key_namespace(
&self,
namespace: &str
) -> Namespaced<'_, Namespaced<'a, K>>where
Namespaced<'a, K>: Sized,
fn with_key_namespace(
&self,
namespace: &str
) -> Namespaced<'_, Namespaced<'a, K>>where
Namespaced<'a, K>: 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
.source§fn set_key<S, V, 'a>(
&'a self,
key: S,
value: &'a V
) -> AsyncBuilder<'a, Self, V> ⓘ
fn set_key<S, V, 'a>( &'a self, key: S, value: &'a V ) -> AsyncBuilder<'a, Self, V> ⓘ
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.source§fn set_binary_key<S, 'a>(
&'a self,
key: S,
bytes: &'a [u8]
) -> AsyncBuilder<'a, Self, ()> ⓘ
fn set_binary_key<S, 'a>( &'a self, key: S, bytes: &'a [u8] ) -> AsyncBuilder<'a, Self, ()> ⓘ
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.source§fn set_numeric_key<S, V>(&self, key: S, value: V) -> AsyncBuilder<'_, Self, ()> ⓘ
fn set_numeric_key<S, V>(&self, key: S, value: V) -> AsyncBuilder<'_, Self, ()> ⓘ
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.source§fn increment_key_by<S, V>(&self, key: S, value: V) -> AsyncBuilder<'_, Self, V> ⓘ
fn increment_key_by<S, V>(&self, key: S, value: V) -> AsyncBuilder<'_, Self, V> ⓘ
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
.source§fn decrement_key_by<S, V>(&self, key: S, value: V) -> AsyncBuilder<'_, Self, V> ⓘ
fn decrement_key_by<S, V>(&self, key: S, value: V) -> AsyncBuilder<'_, Self, V> ⓘ
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
.source§fn get_key<S>(&self, key: S) -> AsyncBuilder<'_, Self> ⓘ
fn get_key<S>(&self, key: S) -> AsyncBuilder<'_, Self> ⓘ
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.source§impl<'a, K> KeyValue for Namespaced<'a, K>where
K: KeyValue,
impl<'a, K> KeyValue for Namespaced<'a, K>where
K: KeyValue,
source§fn execute_key_operation(&self, op: KeyOperation) -> Result<Output, Error>
fn execute_key_operation(&self, op: KeyOperation) -> Result<Output, Error>
Executes a single
KeyOperation
.source§fn key_namespace(&self) -> Option<&str>
fn key_namespace(&self) -> Option<&str>
The current namespace.
source§fn with_key_namespace(
&self,
namespace: &str
) -> Namespaced<'_, Namespaced<'a, K>>where
Namespaced<'a, K>: Sized,
fn with_key_namespace(
&self,
namespace: &str
) -> Namespaced<'_, Namespaced<'a, K>>where
Namespaced<'a, K>: 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
.source§fn set_key<S, V, 'a>(&'a self, key: S, value: &'a V) -> Builder<'a, Self, V>
fn set_key<S, V, 'a>(&'a self, key: S, value: &'a V) -> Builder<'a, Self, V>
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.source§fn set_binary_key<S, 'a>(
&'a self,
key: S,
bytes: &'a [u8]
) -> Builder<'a, Self, ()>
fn set_binary_key<S, 'a>( &'a self, key: S, bytes: &'a [u8] ) -> Builder<'a, Self, ()>
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.source§fn set_numeric_key<S, V>(&self, key: S, value: V) -> Builder<'_, Self, ()>
fn set_numeric_key<S, V>(&self, key: S, value: V) -> Builder<'_, Self, ()>
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.source§fn increment_key_by<S, V>(&self, key: S, value: V) -> Builder<'_, Self, V>
fn increment_key_by<S, V>(&self, key: S, value: V) -> Builder<'_, Self, V>
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
.source§fn decrement_key_by<S, V>(&self, key: S, value: V) -> Builder<'_, Self, V>
fn decrement_key_by<S, V>(&self, key: S, value: V) -> Builder<'_, Self, V>
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
.source§fn get_key<S>(&self, key: S) -> Builder<'_, Self>
fn get_key<S>(&self, key: S) -> Builder<'_, Self>
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.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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more