Struct keeshond_datapack::DataMultistore
source · [−]pub struct DataMultistore { /* private fields */ }
Expand description
Storage that allows lookup and access of DataObjects of multiple types by wrapping multiple DataStores.
Implementations
sourceimpl DataMultistore
impl DataMultistore
sourcepub fn new(source_manager: Rc<RefCell<SourceManager>>) -> DataMultistore
pub fn new(source_manager: Rc<RefCell<SourceManager>>) -> DataMultistore
Constructs a new DataMultistore that gets its Sources from the given SourceManager
sourcepub fn register_type<D: DataObject + 'static>(&self) -> bool
pub fn register_type<D: DataObject + 'static>(&self) -> bool
Informs the DataMultistore of a new DataObject to manage a DataStore for. Returns true if successful.
sourcepub fn store<D: DataObject + 'static>(&self) -> Ref<'_, DataStore<D>>
pub fn store<D: DataObject + 'static>(&self) -> Ref<'_, DataStore<D>>
Returns a reference to the DataStore of the given type. Panics if it cannot be retrieved.
sourcepub fn store_mut<D: DataObject + 'static>(&self) -> RefMut<'_, DataStore<D>>
pub fn store_mut<D: DataObject + 'static>(&self) -> RefMut<'_, DataStore<D>>
Returns a mutable reference to the DataStore of the given type. Panics if it cannot be retrieved.
sourcepub fn try_store<D: DataObject + 'static>(
&self
) -> Option<Ref<'_, DataStore<D>>>
pub fn try_store<D: DataObject + 'static>(
&self
) -> Option<Ref<'_, DataStore<D>>>
Returns a reference to the DataStore of the given type. Returns None if it cannot be retrieved.
sourcepub fn try_store_mut<D: DataObject + 'static>(
&self
) -> Option<RefMut<'_, DataStore<D>>>
pub fn try_store_mut<D: DataObject + 'static>(
&self
) -> Option<RefMut<'_, DataStore<D>>>
Returns a mutable reference to the DataStore of the given type. Returns None if it cannot be retrieved.
sourcepub fn unload_all(&self)
pub fn unload_all(&self)
Unloads all packages from memory. Any DataObjects will be dropped, but pathname-id mappings will be retained in memory so that existing references will not be invalidated. Returns true if the package was loaded.
sourcepub fn unload_unused(&self)
pub fn unload_unused(&self)
Unloads all packages that do not have an active PackageUseToken.
Auto Trait Implementations
impl !RefUnwindSafe for DataMultistore
impl !Send for DataMultistore
impl !Sync for DataMultistore
impl Unpin for DataMultistore
impl !UnwindSafe for DataMultistore
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more