[−][src]Struct keeshond_datapack::DataStore
Storage that allows lookup and access of DataObjects of a given type
Implementations
impl<T: DataObject + 'static> DataStore<T>
[src]
pub fn new(source_manager: Rc<RefCell<SourceManager>>) -> DataStore<T>
[src]
Constructs a new DataStore that gets its Sources from the given SourceManager
pub fn load_package(
&mut self,
package_name: &str
) -> Result<DataStoreOk, DataError>
[src]
&mut self,
package_name: &str
) -> Result<DataStoreOk, DataError>
Loads the package by the given name if it is not already loaded.
pub fn get_id(
&self,
package_name: &str,
pathname: &str
) -> Result<DataId, DataError>
[src]
&self,
package_name: &str,
pathname: &str
) -> Result<DataId, DataError>
Gets the numeric ID of the DataObject from the given package at the given pathname.
pub fn get_id_mut(
&mut self,
package_name: &str,
pathname: &str
) -> Result<DataId, DataError>
[src]
&mut self,
package_name: &str,
pathname: &str
) -> Result<DataId, DataError>
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.
pub fn get(&self, index: DataId) -> Option<&T>
[src]
Returns a reference to the DataObject by the given DataId, if one exists. Otherwise returns None.
pub fn get_mut(&mut self, index: DataId) -> Option<&mut T>
[src]
Returns a mutable reference to the DataObject by the given DataId, if one exists. Otherwise returns None.
pub fn list_package_contents(&self, package_name: &str) -> Vec<String>
[src]
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.
pub fn unload_package(&mut self, package_name: &str) -> bool
[src]
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.
pub fn unload_all(&mut self)
[src]
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.
pub fn package_loaded(&self, package_name: &str) -> bool
[src]
Returns true if the given package is loaded.
pub fn save(
&mut self,
package_name: &str,
pathname: &str,
source_id: SourceId
) -> Result<(), DataError>
[src]
&mut self,
package_name: &str,
pathname: &str,
source_id: SourceId
) -> Result<(), DataError>
pub fn reprepare(&mut self, index: DataId) -> bool
[src]
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.
pub fn reload(
&mut self,
package_name: &str,
pathname: &str
) -> Result<(), DataError>
[src]
&mut self,
package_name: &str,
pathname: &str
) -> Result<(), DataError>
Reloads an already-loaded resource by the given name.
Auto Trait Implementations
impl<T> !RefUnwindSafe for DataStore<T>
impl<T> !Send for DataStore<T>
impl<T> !Sync for DataStore<T>
impl<T> Unpin for DataStore<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for DataStore<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
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.
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>,