Builder

Struct 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>
where K: KeyValue, V: Serialize + Send + Sync,

Source

pub fn expire_in(self, duration: Duration) -> Self

Set this key to expire after duration from now.

Source

pub fn expire_at(self, time: SystemTime) -> Self

Set this key to expire at the provided time.

Source

pub const fn keep_existing_expiration(self) -> Self

If the key already exists, do not update the currently set expiration.

Source

pub const fn only_if_exists(self) -> Self

Only set the value if this key already exists.

Source

pub const fn only_if_vacant(self) -> Self

Only set the value if this key isn’t present.

Source

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.

Source

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.

Source

pub fn execute(self) -> Result<KeyStatus, Error>

Executes the operation using the configured options.

Auto Trait Implementations§

§

impl<'a, KeyValue, V> Freeze for Builder<'a, KeyValue, V>

§

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>
where KeyValue: Sync, V: Sync,

§

impl<'a, KeyValue, V> Sync for Builder<'a, KeyValue, V>
where KeyValue: Sync, V: Sync,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.