Struct entity_inmemory::InmemoryDatabase [−][src]
pub struct InmemoryDatabase { /* fields omitted */ }
Represents an in-memory database that performs synchronous insertion,
retrieval, and removal. If the feature serde
is enabled, this database
can be serialized and deserialized.
Implementations
impl InmemoryDatabase
[src]
impl InmemoryDatabase
[src]
pub fn ids(&self) -> HashSet<Id>
[src]
Returns ids of all ents stored in the database
pub fn has_id(&self, id: Id) -> bool
[src]
Returns true if database contains the provided id
pub fn ids_for_type(&self, type: &str) -> HashSet<Id>
[src]
Returns ids of all ents for the given type
Trait Implementations
impl Database for InmemoryDatabase
[src]
fn get_all(&self, ids: Vec<Id>) -> DatabaseResult<Vec<Box<dyn Ent>>>
[src]
fn find_all(&self, query: Query) -> DatabaseResult<Vec<Box<dyn Ent>>>
[src]
fn get(&self, id: Id) -> DatabaseResult<Option<Box<dyn Ent>>>
[src]
fn remove(&self, id: Id) -> DatabaseResult<bool>
[src]
fn insert(&self, ent: Box<dyn Ent>) -> DatabaseResult<Id>
[src]
impl Default for InmemoryDatabase
[src]
Auto Trait Implementations
impl RefUnwindSafe for InmemoryDatabase
impl Send for InmemoryDatabase
impl Sync for InmemoryDatabase
impl Unpin for InmemoryDatabase
impl UnwindSafe for InmemoryDatabase
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsAny for T where
T: 'static,
[src]
T: 'static,
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
pub fn as_mut_any(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DatabaseExt for T where
T: Database,
[src]
T: Database,
pub fn insert_typed<E>(&self, ent: E) -> Result<usize, DatabaseError> where
E: Ent,
[src]
E: Ent,
pub fn get_typed<E>(&self, id: usize) -> Result<Option<E>, DatabaseError> where
E: Ent,
[src]
E: Ent,
pub fn get_all_typed<E>(
&self,
ids: Vec<usize, Global>
) -> Result<Vec<E, Global>, DatabaseError> where
E: Ent,
[src]
&self,
ids: Vec<usize, Global>
) -> Result<Vec<E, Global>, DatabaseError> where
E: Ent,
pub fn find_all_typed<E>(
&self,
query: Query
) -> Result<Vec<E, Global>, DatabaseError> where
E: Ent,
[src]
&self,
query: Query
) -> Result<Vec<E, Global>, DatabaseError> where
E: Ent,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,