Skip to main content

MemoryRepository

Struct MemoryRepository 

Source
pub struct MemoryRepository<E> { /* private fields */ }
Expand description

Thread-safe in-memory repository used as a reference adapter.

Implementations§

Source§

impl<E> MemoryRepository<E>

Source

pub const fn new() -> Self

Creates an empty repository.

Trait Implementations§

Source§

impl<E: Debug> Debug for MemoryRepository<E>

Source§

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

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

impl<E> Default for MemoryRepository<E>

Source§

fn default() -> Self

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

impl<E> ReadRepository<E> for MemoryRepository<E>
where E: Entity + Queryable + Clone + 'static,

Source§

fn find(&self, params: FindParams) -> BoxFuture<'_, SoapResult<Vec<E>>>

Finds entities matching the supplied parameters.
Source§

fn get<'a>(&'a self, id: &'a E::Id) -> BoxFuture<'a, SoapResult<Option<E>>>

Finds one entity by its stable identifier.
Source§

fn count(&self, params: FindParams) -> BoxFuture<'_, SoapResult<u64>>

Counts entities matching the condition in the supplied parameters. Pagination and sorting are ignored.
Source§

impl<E> WriteRepository<E> for MemoryRepository<E>
where E: Entity + Queryable + Clone + 'static,

Source§

fn insert(&self, entity: E) -> BoxFuture<'_, SoapResult<()>>

Inserts a new entity and returns a conflict for a duplicate identifier.
Source§

fn replace(&self, entity: E) -> BoxFuture<'_, SoapResult<()>>

Replaces an existing entity with the same identifier.
Source§

fn remove<'a>(&'a self, id: &'a E::Id) -> BoxFuture<'a, SoapResult<bool>>

Removes an entity and reports whether it existed.

Auto Trait Implementations§

§

impl<E> !Freeze for MemoryRepository<E>

§

impl<E> RefUnwindSafe for MemoryRepository<E>

§

impl<E> Send for MemoryRepository<E>
where E: Send,

§

impl<E> Sync for MemoryRepository<E>
where E: Send + Sync,

§

impl<E> Unpin for MemoryRepository<E>
where E: Unpin,

§

impl<E> UnsafeUnpin for MemoryRepository<E>

§

impl<E> UnwindSafe for MemoryRepository<E>

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.