Struct bonsaidb_core::keyvalue::set::Builder
source · pub struct Builder<'a, KeyValue, V> { /* private fields */ }
Expand description
Builder for a Command::Set
key-value operation.
Implementations§
source§impl<'a, K, V> Builder<'a, K, V>
impl<'a, K, V> Builder<'a, K, V>
sourcepub fn expire_in(self, duration: Duration) -> Self
pub fn expire_in(self, duration: Duration) -> Self
Set this key to expire after duration
from now.
sourcepub fn expire_at(self, time: SystemTime) -> Self
pub fn expire_at(self, time: SystemTime) -> Self
Set this key to expire at the provided time
.
sourcepub const fn keep_existing_expiration(self) -> Self
pub const fn keep_existing_expiration(self) -> Self
If the key already exists, do not update the currently set expiration.
sourcepub const fn only_if_exists(self) -> Self
pub const fn only_if_exists(self) -> Self
Only set the value if this key already exists.
sourcepub const fn only_if_vacant(self) -> Self
pub const fn only_if_vacant(self) -> Self
Only set the value if this key isn’t present.
sourcepub fn returning_previous(self) -> Result<Option<Value>, Error>
pub fn returning_previous(self) -> Result<Option<Value>, Error>
Executes the Set operation, requesting the previous value be returned. If no change is made, None will be returned.
sourcepub fn returning_previous_as<OtherV: for<'de> Deserialize<'de>>(
self
) -> Result<Option<OtherV>, Error>
pub fn returning_previous_as<OtherV: for<'de> Deserialize<'de>>( self ) -> Result<Option<OtherV>, Error>
Executes the Set operation, requesting the previous value be returned. If no change is made, None will be returned.
Auto Trait Implementations§
impl<'a, KeyValue, V> RefUnwindSafe for Builder<'a, KeyValue, V>where
KeyValue: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, KeyValue, V> Send for Builder<'a, KeyValue, V>
impl<'a, KeyValue, V> Sync for Builder<'a, KeyValue, V>
impl<'a, KeyValue, V> Unpin for Builder<'a, KeyValue, V>
impl<'a, KeyValue, V> UnwindSafe for Builder<'a, KeyValue, V>where
KeyValue: RefUnwindSafe,
V: RefUnwindSafe,
Blanket Implementations§
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