pub struct LoadContext<'a> { /* private fields */ }Expand description
Context provided to asset loaders during loading.
The context provides:
- The path of the asset being loaded
- Methods to declare dependencies on other assets
- Metadata about the loading process
Loaders call add_dependency to declare
that the asset being loaded depends on another asset. After loading
completes, the AssetServer records these edges in the dependency
graph so that cascade reloads work correctly.
Implementations§
Source§impl<'a> LoadContext<'a>
impl<'a> LoadContext<'a>
Sourcepub fn new(asset_path: AssetPath<'static>) -> Self
pub fn new(asset_path: AssetPath<'static>) -> Self
Creates a new load context for the given asset path.
Sourcepub fn add_dependency(&mut self, dependency_path: impl Into<String>)
pub fn add_dependency(&mut self, dependency_path: impl Into<String>)
Declares that the asset being loaded depends on another asset.
After the load completes, the AssetServer will record this
dependency so that changes to dependency_path trigger a
cascade reload of the current asset.
§Arguments
dependency_path- Path of the asset this asset depends on
Sourcepub fn dependencies(&self) -> &[String]
pub fn dependencies(&self) -> &[String]
Returns the list of dependencies declared during loading.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for LoadContext<'a>
impl<'a> RefUnwindSafe for LoadContext<'a>
impl<'a> Send for LoadContext<'a>
impl<'a> Sync for LoadContext<'a>
impl<'a> Unpin for LoadContext<'a>
impl<'a> UnsafeUnpin for LoadContext<'a>
impl<'a> UnwindSafe for LoadContext<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more