pub trait StoreFor<T: Storable>: Configurable + StoreCallbacks<T> + Sealed<T> {
Show 17 methods
// Required methods
fn store(&self) -> &Store<T>;
fn store_mut(&mut self) -> &mut Store<T>;
fn store_typeinfo() -> &'static str;
// Provided methods
fn idmap(&self) -> Option<&IdMap<T::HandleType>> { ... }
fn idmap_mut(&mut self) -> Option<&mut IdMap<T::HandleType>> { ... }
fn insert(&mut self, item: T) -> Result<T::HandleType, StamError> { ... }
fn add(self, item: T) -> Result<Self, StamError>
where Self: Sized { ... }
fn has(&self, item: impl Request<T>) -> bool { ... }
unsafe fn get_unchecked(&self, handle: T::HandleType) -> Option<&T> { ... }
fn get(&self, item: impl Request<T>) -> Result<&T, StamError> { ... }
fn get_mut(&mut self, item: impl Request<T>) -> Result<&mut T, StamError> { ... }
fn remove(&mut self, handle: T::HandleType) -> Result<(), StamError> { ... }
fn resolve_id(&self, id: &str) -> Result<T::HandleType, StamError> { ... }
fn iter(&self) -> StoreIter<'_, T>
where T: Storable<StoreType = Self> { ... }
fn iter_mut(&mut self) -> StoreIterMut<'_, T> { ... }
fn next_handle(&self) -> T::HandleType { ... }
fn last_handle(&self) -> T::HandleType { ... }
}Expand description
This trait is implemented on types that provide storage for a certain other generic type (T) It belongs to the low-level API. It is a sealed trait, not implementable outside this crate.
Required Methods§
sourcefn store(&self) -> &Store<T>
fn store(&self) -> &Store<T>
Get a reference to the entire store for the associated type This is a low-level API method.
sourcefn store_mut(&mut self) -> &mut Store<T>
fn store_mut(&mut self) -> &mut Store<T>
Get a mutable reference to the entire store for the associated type This is a low-level API method.
fn store_typeinfo() -> &'static str
Provided Methods§
sourcefn idmap(&self) -> Option<&IdMap<T::HandleType>>
fn idmap(&self) -> Option<&IdMap<T::HandleType>>
Get a reference to the id map for the associated type, mapping global ids to internal ids This is a low-level API method.
sourcefn idmap_mut(&mut self) -> Option<&mut IdMap<T::HandleType>>
fn idmap_mut(&mut self) -> Option<&mut IdMap<T::HandleType>>
Get a mutable reference to the id map for the associated type, mapping global ids to internal ids This is a low-level API method.
sourcefn insert(&mut self, item: T) -> Result<T::HandleType, StamError>
fn insert(&mut self, item: T) -> Result<T::HandleType, StamError>
Adds an item to the store. Returns a handle to it upon success.
sourcefn add(self, item: T) -> Result<Self, StamError>where
Self: Sized,
fn add(self, item: T) -> Result<Self, StamError>where
Self: Sized,
Inserts items into the store using a builder pattern
sourceunsafe fn get_unchecked(&self, handle: T::HandleType) -> Option<&T>
unsafe fn get_unchecked(&self, handle: T::HandleType) -> Option<&T>
Get a reference to an item from the store, by handle, without checking validity.
§Safety
Calling this method with an out-of-bounds index is undefined behavior │
even if the resulting reference is not used. │
sourcefn get(&self, item: impl Request<T>) -> Result<&T, StamError>
fn get(&self, item: impl Request<T>) -> Result<&T, StamError>
Get a reference to an item from the store
This is a low-level API method, you usually want to use dedicated high-level methods like AnnotationStore::annotation() instead.
sourcefn get_mut(&mut self, item: impl Request<T>) -> Result<&mut T, StamError>
fn get_mut(&mut self, item: impl Request<T>) -> Result<&mut T, StamError>
Get a mutable reference to an item from the store by internal ID This is a low-level API method
sourcefn remove(&mut self, handle: T::HandleType) -> Result<(), StamError>
fn remove(&mut self, handle: T::HandleType) -> Result<(), StamError>
Removes an item by handle, returns an error if the item has dependencies and can’t be removed
sourcefn resolve_id(&self, id: &str) -> Result<T::HandleType, StamError>
fn resolve_id(&self, id: &str) -> Result<T::HandleType, StamError>
Resolves an ID to a handle. Also works for temporary IDs if enabled. This is a low-level API method. You usually don’t want to call this directly.
sourcefn iter(&self) -> StoreIter<'_, T>where
T: Storable<StoreType = Self>,
fn iter(&self) -> StoreIter<'_, T>where
T: Storable<StoreType = Self>,
Iterate over all items in the store
This is a low-level API method, use dedicated high-level iterators like annotations(), resources() instead.
sourcefn iter_mut(&mut self) -> StoreIterMut<'_, T>
fn iter_mut(&mut self) -> StoreIterMut<'_, T>
Iterate over the store, mutably This is a low-level API method.
sourcefn next_handle(&self) -> T::HandleType
fn next_handle(&self) -> T::HandleType
Return the internal id that will be assigned for the next item to the store This is a low-level API method.
sourcefn last_handle(&self) -> T::HandleType
fn last_handle(&self) -> T::HandleType
Return the internal id that was assigned to last inserted item This is a low-level API method.