MSetBuilder

Struct MSetBuilder 

Source
pub struct MSetBuilder<'a> { /* private fields */ }
Expand description

A builder struct for commands where you set multiple values at once. It utilizes references to ensure that it does not copy any of the data given to it. It supports the classic builder-pattern, as well as a mutable pattern.

§Example

 //Builder-style
let mut builder = MSetBuilder::new().set(b"example-key", b"some-value");

 // Mutable style
builder.append(b"some-other-key", b"some-value");

Implementations§

Source§

impl<'a> MSetBuilder<'a>

Source

pub fn new() -> Self

Create a new instance.

Source

pub fn append<K, V>(&'a mut self, key: &'a K, value: &'a V)
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Add key to be set to value, mutable style.

Source

pub fn set<K, V>(self, key: &'a K, value: &'a V) -> Self
where K: AsRef<[u8]>, V: AsRef<[u8]>,

Add key to be set to value, builder-style.

Trait Implementations§

Source§

impl<'a> Debug for MSetBuilder<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for MSetBuilder<'a>

Source§

fn default() -> MSetBuilder<'a>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for MSetBuilder<'a>

§

impl<'a> RefUnwindSafe for MSetBuilder<'a>

§

impl<'a> Send for MSetBuilder<'a>

§

impl<'a> Sync for MSetBuilder<'a>

§

impl<'a> Unpin for MSetBuilder<'a>

§

impl<'a> UnwindSafe for MSetBuilder<'a>

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, 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.