Struct distill_loader::loader::Loader [−][src]
Loads and tracks lifetimes of asset data.
Implementations
impl Loader
[src]
pub fn new(io: Box<dyn LoaderIO>) -> Loader
[src]
pub fn new_with_handle_allocator(
io: Box<dyn LoaderIO>,
handle_allocator: Arc<dyn HandleAllocator>
) -> Loader
[src]
io: Box<dyn LoaderIO>,
handle_allocator: Arc<dyn HandleAllocator>
) -> Loader
pub fn with_serde_context<R>(
&self,
tx: &Sender<RefOp>,
mut f: impl FnMut() -> R
) -> R
[src]
&self,
tx: &Sender<RefOp>,
mut f: impl FnMut() -> R
) -> R
pub fn get_load(&self, id: AssetUuid) -> Option<LoadHandle>
[src]
Returns the load handle for the asset with the given UUID, if present.
This will only return Some(..)
if there has been a previous call to Loader::add_ref
.
Parameters
id
: UUID of the asset.
pub fn get_load_info(&self, load: LoadHandle) -> Option<LoadInfo>
[src]
Returns the number of references to an asset.
Note: The information is true at the time the LoadInfo
is retrieved. The actual number
of references may change.
Parameters
load_handle
: ID allocated byLoader
to track loading of the asset.
pub fn get_load_status(&self, load: LoadHandle) -> LoadStatus
[src]
Returns the asset load status.
Parameters
load
: ID allocated byLoader
to track loading of the asset.
pub fn add_ref<U: Into<AssetUuid>>(&self, id: U) -> LoadHandle
[src]
Adds a reference to an asset and returns its LoadHandle
.
If the asset is already loaded, this returns the existing LoadHandle
. If it is not
loaded, this allocates a new LoadHandle
and returns that.
Parameters
id
: UUID of the asset.
pub fn add_ref_indirect(&self, id: IndirectIdentifier) -> LoadHandle
[src]
Adds a reference to an indirect id and returns its LoadHandle
with LoadHandle::is_indirect
set to true
.
Parameters
id
: IndirectIdentifier for the load.
pub fn get_asset_type(&self, load: LoadHandle) -> Option<AssetTypeId>
[src]
Returns the AssetTypeId
for the currently loaded asset of the provided load handle.
Parameters
load
: ID allocated byLoader
to track loading of the asset.
pub fn remove_ref(&self, load: LoadHandle)
[src]
Removes a reference to an asset.
Parameters
load_handle
: ID allocated byLoader
to track loading of the asset.
pub fn process(
&mut self,
asset_storage: &dyn AssetStorage,
resolver: &dyn IndirectionResolver
) -> Result<()>
[src]
&mut self,
asset_storage: &dyn AssetStorage,
resolver: &dyn IndirectionResolver
) -> Result<()>
Processes pending load operations.
Load operations include:
- Requesting asset metadata.
- Requesting asset data.
- Committing completed
AssetLoadOp
s. - Updating the
LoadStatus
es of assets. - Resolving active
IndirectIdentifier
s.
Parameters
asset_storage
: Storage for all assets of all asset types.
pub fn indirection_table(&self) -> IndirectionTable
[src]
Returns a reference to the loader's IndirectionTable
.
When a user fetches an asset by LoadHandle, implementors of AssetStorage
should resolve LoadHandles where LoadHandle::is_indirect
returns true by using IndirectionTable::resolve
.
IndirectionTable is Send + Sync + Clone so that it can be retrieved once at startup,
then stored in implementors of AssetStorage
.
pub fn invalidate_assets(&self, assets: &[AssetUuid])
[src]
Invalidates the data & metadata of the provided asset IDs.
This causes the asset data to be reloaded.
pub fn invalidate_paths(&self, paths: &[PathBuf])
[src]
Invalidates indirect identifiers that may match the provided paths.
This may cause indirect handles to resolve to new assets.
Auto Trait Implementations
impl !RefUnwindSafe for Loader
[src]
impl Send for Loader
[src]
impl Sync for Loader
[src]
impl Unpin for Loader
[src]
impl !UnwindSafe for Loader
[src]
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,
pub 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, 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.
pub 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>,