pub struct DataStore<T: DataObject + 'static> { /* private fields */ }
Expand description

Storage that allows lookup and access of DataObjects of a given type

Implementations

Constructs a new DataStore that gets its Sources from the given SourceManager

Loads the package by the given name if it is not already loaded.

Gets the numeric ID of the DataObject from the given package at the given pathname.

Gets the numeric ID of the DataObject from the given package at the given pathname. If the package is not loaded, it will be loaded automatically.

Returns a reference to the DataObject by the given DataId, if one exists. Otherwise returns None.

Returns a mutable reference to the DataObject by the given DataId, if one exists. Otherwise returns None.

Returns a string list of the names of each DataObject in the given package. The package will need to have been loaded or this will return an empty list. Please do not call this repeatedly.

Unloads the given package 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.

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.

Unloads all packages that do not have an active PackageUseToken.

Returns true if the given package is loaded.

Returns a PackageUseToken that can be used to keep the given package from being unloaded automatically.

Saves the indicated item using the Source given by SourceId.

Marks the DataObject by the given DataId as needing to be “reprepared”. Use this, for example, when data has been changed and it needs to be reflected in a backend via the PreparedStore. Returns true if the data was marked for reprepare, otherwise false.

Reloads an already-loaded resource by the given name.

Loads a single DataObject from the given source and returns it. This function does not index, cache, or track the loaded object in any way. Loading the object through here will result in a separate copy in memory even if it was previously loaded through the usual package loading mechanism. For most cases you should use load_package() or get_id_mut() instead.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

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

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

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.