Skip to main content

MemoryStore

Struct MemoryStore 

Source
pub struct MemoryStore<V>
where V: Clone,
{ /* private fields */ }
Expand description

In-memory Store backed by a FIFO queue.

Implementations§

Source§

impl<V> MemoryStore<V>
where V: Clone,

Source

pub fn new() -> Self

Create an empty in-memory store.

Trait Implementations§

Source§

impl<V> Default for MemoryStore<V>
where V: Clone,

Source§

fn default() -> Self

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

impl<V> Store<V> for MemoryStore<V>
where V: Clone + Send + Sync + 'static,

Source§

fn append(&self, value: V) -> AppResult<()>

Append a new value.
Source§

fn pop_oldest(&self) -> AppResult<Option<V>>

Remove and return the oldest value, if any.
Source§

fn snapshot(&self) -> AppResult<Vec<V>>

Snapshot all currently buffered values.
Source§

fn flush(&self) -> AppResult<Vec<V>>

Drain and return all currently buffered values.
Source§

fn size(&self) -> AppResult<usize>

Return the current item count.
Source§

fn touch(&self) -> AppResult<()>

Update last-activity metadata.
Source§

fn last_activity(&self) -> AppResult<Instant>

Return the last activity timestamp.
Source§

fn close(&self) -> AppResult<()>

Release store resources.

Auto Trait Implementations§

§

impl<V> !Freeze for MemoryStore<V>

§

impl<V> !RefUnwindSafe for MemoryStore<V>

§

impl<V> Send for MemoryStore<V>
where V: Send,

§

impl<V> Sync for MemoryStore<V>
where V: Send,

§

impl<V> Unpin for MemoryStore<V>
where V: Unpin,

§

impl<V> UnsafeUnpin for MemoryStore<V>

§

impl<V> UnwindSafe for MemoryStore<V>
where V: UnwindSafe,

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.