Struct keeshond_datapack::DataHandle [−][src]
pub struct DataHandle<T: DataObject + 'static> { /* fields omitted */ }
Expand description
A path to a data resource, resolvable to a cached DataId.
Implementations
impl<T: DataObject + 'static> DataHandle<T>
[src]
impl<T: DataObject + 'static> DataHandle<T>
[src]pub fn new(package: &str, path: &str) -> DataHandle<T>
[src]
pub fn new(package: &str, path: &str) -> DataHandle<T>
[src]Creates a new DataHandle with the given resource path. The data ID will be unresolved. You will need to call resolve() for the data ID to point to a valid resource.
pub fn set_path(&mut self, package: &str, path: &str)
[src]
pub fn set_path(&mut self, package: &str, path: &str)
[src]Changes the resource path. The data ID will reset to be unresolved. You will need to call resolve() for the data ID to point to a valid resource.
pub fn id(&self) -> DataId
[src]
pub fn id(&self) -> DataId
[src]Returns the data ID. You will need to call resolve() beforehand for the data ID to point to a valid resource.
pub fn resolved(&self) -> bool
[src]
pub fn resolved(&self) -> bool
[src]Returns true if the path has been resolved via a call to resolve().
pub fn resolve(
&self,
data_res: &mut DataStore<T>,
load_error: LoadErrorMode
) -> DataId
[src]
pub fn resolve(
&self,
data_res: &mut DataStore<T>,
load_error: LoadErrorMode
) -> DataId
[src]Resolves the data ID using the given DataStore. Returns the resolved data ID, which is cached inside the object. If load_error is Fatal, this function will panic if the load fails. Otherwise it will simply return a null data ID.
pub fn get<'a, 'b: 'a>(
&self,
data_res: &'b mut DataStore<T>,
load_error: LoadErrorMode
) -> Option<&'a T>
[src]
pub fn get<'a, 'b: 'a>(
&self,
data_res: &'b mut DataStore<T>,
load_error: LoadErrorMode
) -> Option<&'a T>
[src]Returns a reference to data object in the store, if it exists. If the data object is not resolved, then resolve() will be called, and then the data object reference returned, if available.
pub fn get_mut<'a, 'b: 'a>(
&self,
data_res: &'b mut DataStore<T>,
load_error: LoadErrorMode
) -> Option<&'a mut T>
[src]
pub fn get_mut<'a, 'b: 'a>(
&self,
data_res: &'b mut DataStore<T>,
load_error: LoadErrorMode
) -> Option<&'a mut T>
[src]Returns a mutable reference to data object in the store, if it exists. If the data object is not resolved, then resolve() will be called, and then the data object reference returned, if available.
pub fn get_if_resolved<'a, 'b: 'a>(
&self,
data_res: &'b DataStore<T>
) -> Option<&'a T>
[src]
pub fn get_if_resolved<'a, 'b: 'a>(
&self,
data_res: &'b DataStore<T>
) -> Option<&'a T>
[src]Returns a reference to data object in the store, if it exists. If the data object is not resolved, returns None instead of attempting to resolve.
pub fn get_mut_if_resolved<'a, 'b: 'a>(
&self,
data_res: &'b mut DataStore<T>
) -> Option<&'a mut T>
[src]
pub fn get_mut_if_resolved<'a, 'b: 'a>(
&self,
data_res: &'b mut DataStore<T>
) -> Option<&'a mut T>
[src]Returns a mutable reference to data object in the store, if it exists. If the data object is not resolved, returns None instead of attempting to resolve.
pub fn resolve_if_loaded(&self, data_res: &DataStore<T>) -> DataId
[src]
pub fn resolve_if_loaded(&self, data_res: &DataStore<T>) -> DataId
[src]Resolves the data ID using the given DataStore. Returns the resolved data ID, which is cached inside the object. If the data is not yet loaded, returns a null ID.
Trait Implementations
impl<T: DataObject + 'static> Clone for DataHandle<T>
[src]
impl<T: DataObject + 'static> Clone for DataHandle<T>
[src]impl<T: DataObject + 'static> Debug for DataHandle<T>
[src]
impl<T: DataObject + 'static> Debug for DataHandle<T>
[src]impl<T: DataObject + 'static> Default for DataHandle<T>
[src]
impl<T: DataObject + 'static> Default for DataHandle<T>
[src]Auto Trait Implementations
impl<T> !RefUnwindSafe for DataHandle<T>
impl<T> Send for DataHandle<T> where
T: Send,
T: Send,
impl<T> !Sync for DataHandle<T>
impl<T> Unpin for DataHandle<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for DataHandle<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more