InsertMode

Enum InsertMode 

Source
#[repr(C)]
pub enum InsertMode { Overwrite = 0, Add = 1, Append = 2, Prepend = 3, }
Expand description

Selects the behavior for an insert when the new key matches an existing key.

A KV store maintains the property that its keys are unique from each other. If an insert has a key that doesn’t match any key already in the store, then the pair of the key and the new value is inserted into the store. However, if the insert’s key does match a key already in the store, then no new key-value pair is inserted, and the insert’s mode determines what it does instead.

Variants§

§

Overwrite = 0

Updates the existing key’s value by overwriting it with the new value.

This is the default mode.

§

Add = 1

Fails, leaving the existing key’s value unmodified.

With this mode, the insert fails with a “precondition failed” error, and does not modify the existing value. Inserts with this mode will only “add” new key-value pairs; they are prevented from modifying any existing ones.

§

Append = 2

Updates the existing key’s value by appending the new value to it.

§

Prepend = 3

Updates the existing key’s value by prepending the new value to it.

Trait Implementations§

Source§

impl Clone for InsertMode

Source§

fn clone(&self) -> InsertMode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for InsertMode

Source§

fn default() -> InsertMode

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

impl Copy for InsertMode

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.