omaha_client::storage

Struct MemStorage

Source
pub struct MemStorage { /* private fields */ }
Expand description

The MemStorage struct is an in-memory-only implementation of the Storage trait, to be used in testing scenarios.

Implementations§

Source§

impl MemStorage

Source

pub fn new() -> Self

Source

pub fn committed(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Debug for MemStorage

Source§

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

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

impl Default for MemStorage

Source§

fn default() -> Self

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

impl Storage for MemStorage

Source§

fn get_string<'a>(&'a self, key: &'a str) -> BoxFuture<'_, Option<String>>

Get a string from the backing store. Returns None if there is no value for the given key.

Source§

fn get_int<'a>(&'a self, key: &'a str) -> BoxFuture<'_, Option<i64>>

Get an int from the backing store. Returns None if there is no value for the given key.

Source§

fn get_bool<'a>(&'a self, key: &'a str) -> BoxFuture<'_, Option<bool>>

Get a boolean from the backing store. Returns None if there is no value for the given key.

Source§

fn set_string<'a>( &'a mut self, key: &'a str, value: &'a str, ) -> BoxFuture<'_, Result<(), Self::Error>>

Set a value to be stored in the backing store. The implementation should cache the value until the |commit()| fn is called, and then persist all cached values at that time.

Source§

fn set_int<'a>( &'a mut self, key: &'a str, value: i64, ) -> BoxFuture<'_, Result<(), Self::Error>>

Set a value to be stored in the backing store. The implementation should cache the value until the |commit()| fn is called, and then persist all cached values at that time.

Source§

fn set_bool<'a>( &'a mut self, key: &'a str, value: bool, ) -> BoxFuture<'_, Result<(), Self::Error>>

Set a value to be stored in the backing store. The implementation should cache the value until the |commit()| fn is called, and then persist all cached values at that time.

Source§

fn commit(&mut self) -> BoxFuture<'_, Result<(), Self::Error>>

Persist all cached values to storage.

Source§

type Error = StorageErrors

Source§

fn remove<'a>( &'a mut self, key: &'a str, ) -> BoxFuture<'_, Result<(), Self::Error>>

Remove the value for |key| from the backing store. The implementation should cache that the value has been removed until the |commit()| fn is called, and then persist all changes at that time. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> StorageExt for T
where T: Storage,

Source§

fn set_option_int<'a>( &'a mut self, key: &'a str, value: Option<i64>, ) -> BoxFuture<'_, Result<(), Self::Error>>

Set an Option to be stored in the backing store. The implementation should cache the value until the |commit()| fn is called, and then persist all cached values at that time. If the Option is None, the implementation should call |remove()| for the key.
Source§

fn get_time<'a>(&'a self, key: &'a str) -> BoxFuture<'_, Option<SystemTime>>

Get a SystemTime from the backing store. Returns None if there is no value for the given key, or if the value for the key has a different type.
Source§

fn set_time<'a>( &'a mut self, key: &'a str, value: impl Into<SystemTime>, ) -> BoxFuture<'_, Result<(), Self::Error>>

Set a SystemTime to be stored in the backing store. The implementation should cache the value until the |commit()| fn is called, and then persist all cached values at that time. Note that submicrosecond will be dropped.
Source§

fn remove_or_log<'a>(&'a mut self, key: &'a str) -> BoxFuture<'_, ()>

Remove the value for |key| from the backing store, log an error message on error.
Source§

fn commit_or_log(&mut self) -> BoxFuture<'_, ()>

Persist all cached values to storage, log an error message on error.
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.
Source§

impl<T> Unless for T

Source§

fn unless(self, option: Option<T>) -> T

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more