[][src]Struct keeshond_datapack::DataStore

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

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

Methods

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]

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]

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]

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 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.

Auto Trait Implementations

impl<T> !Send for DataStore<T>

impl<T> !Sync for DataStore<T>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.