pub struct NestedLoadBuilder<'ctx, 'builder> { /* private fields */ }Expand description
A builder for loading nested assets inside a LoadContext.
Implementations§
Source§impl<'ctx, 'builder> NestedLoadBuilder<'ctx, 'builder>
impl<'ctx, 'builder> NestedLoadBuilder<'ctx, 'builder>
Sourcepub fn with_settings<S: Settings>(
self,
settings: impl Fn(&mut S) + Send + Sync + 'static,
) -> Self
pub fn with_settings<S: Settings>( self, settings: impl Fn(&mut S) + Send + Sync + 'static, ) -> Self
Use the given settings function to override the asset’s AssetLoader settings.
The type S must match the configured AssetLoader::Settings or settings changes will
be ignored and an error will be printed to the log.
Repeatedly calling this method will “chain” the operations (matching the order of these calls).
Sourcepub fn override_unapproved(self) -> Self
pub fn override_unapproved(self) -> Self
Loads from unapproved paths are allowed, even if
AssetPlugin::unapproved_path_mode is
Deny.
Sourcepub fn load<'a, A: Asset>(self, path: impl Into<AssetPath<'a>>) -> Handle<A>
pub fn load<'a, A: Asset>(self, path: impl Into<AssetPath<'a>>) -> Handle<A>
Loads the provided path as the given type and returns the handle.
This is a “deferred” load, meaning the caller will not have access to the loaded data; to
access the loaded data, use Self::load_value.
Sourcepub fn load_erased<'a>(
self,
type_id: TypeId,
path: impl Into<AssetPath<'a>>,
) -> UntypedHandle
pub fn load_erased<'a>( self, type_id: TypeId, path: impl Into<AssetPath<'a>>, ) -> UntypedHandle
Loads the provided path as the given type and returns the handle.
This is a “deferred” load, meaning the caller will not have access to the loaded data; to
access the loaded data, use Self::load_erased_value.
Sourcepub fn load_untyped<'a>(
self,
path: impl Into<AssetPath<'a>>,
) -> Handle<LoadedUntypedAsset>
pub fn load_untyped<'a>( self, path: impl Into<AssetPath<'a>>, ) -> Handle<LoadedUntypedAsset>
Loads the provided path with an unknown type (which is guessed based on the path or meta file).
This is a “deferred” load, meaning the caller will not have access to the loaded data; to
access the loaded data, use Self::load_untyped_value.
Sourcepub async fn load_value<'a, A: Asset>(
self,
path: impl Into<AssetPath<'a>>,
) -> Result<LoadedAsset<A>, LoadDirectError>
pub async fn load_value<'a, A: Asset>( self, path: impl Into<AssetPath<'a>>, ) -> Result<LoadedAsset<A>, LoadDirectError>
Loads the provided path as the given type, returning the loaded data.
This load is async and therefore needs to be awaited before returning the loaded data.
Sourcepub async fn load_erased_value<'a>(
self,
type_id: TypeId,
path: impl Into<AssetPath<'a>>,
) -> Result<ErasedLoadedAsset, LoadDirectError>
pub async fn load_erased_value<'a>( self, type_id: TypeId, path: impl Into<AssetPath<'a>>, ) -> Result<ErasedLoadedAsset, LoadDirectError>
Loads the provided path as the given type, returning the loaded data.
This load is async and therefore needs to be awaited before returning the loaded data.
Sourcepub async fn load_untyped_value<'a>(
self,
path: impl Into<AssetPath<'a>>,
) -> Result<ErasedLoadedAsset, LoadDirectError>
pub async fn load_untyped_value<'a>( self, path: impl Into<AssetPath<'a>>, ) -> Result<ErasedLoadedAsset, LoadDirectError>
Loads the provided path with an unknown type (which is guessed based on the path or meta file), returning the loaded data.
This load is async and therefore needs to be awaited before returning the loaded data.
Sourcepub async fn load_value_from_reader<'a, A: Asset>(
self,
path: impl Into<AssetPath<'a>>,
reader: &'builder mut dyn Reader,
) -> Result<LoadedAsset<A>, LoadDirectError>
pub async fn load_value_from_reader<'a, A: Asset>( self, path: impl Into<AssetPath<'a>>, reader: &'builder mut dyn Reader, ) -> Result<LoadedAsset<A>, LoadDirectError>
Loads the given type from the given reader, returning the loaded data.
This load is async and therefore needs to be awaited before returning the loaded data. The provided path determines the path used for handles of subassets, as well as any relative paths of assets used by the nested loader.
Sourcepub async fn load_erased_value_from_reader<'a>(
self,
type_id: TypeId,
path: impl Into<AssetPath<'a>>,
reader: &'builder mut dyn Reader,
) -> Result<ErasedLoadedAsset, LoadDirectError>
pub async fn load_erased_value_from_reader<'a>( self, type_id: TypeId, path: impl Into<AssetPath<'a>>, reader: &'builder mut dyn Reader, ) -> Result<ErasedLoadedAsset, LoadDirectError>
Loads the given type from the given reader, returning the loaded data.
This load is async and therefore needs to be awaited before returning the loaded data. The provided path determines the path used for handles of subassets, as well as any relative paths of assets used by the nested loader.
Sourcepub async fn load_untyped_value_from_reader<'a>(
self,
path: impl Into<AssetPath<'a>>,
reader: &'builder mut dyn Reader,
) -> Result<ErasedLoadedAsset, LoadDirectError>
pub async fn load_untyped_value_from_reader<'a>( self, path: impl Into<AssetPath<'a>>, reader: &'builder mut dyn Reader, ) -> Result<ErasedLoadedAsset, LoadDirectError>
Loads an asset from the given reader with an unknown type (which is guessed based on the
path or meta file), returning the loaded data.
This load is async and therefore needs to be awaited before returning the loaded data. The provided path determines the path used for handles of subassets, as well as any relative paths of assets used by the nested loader.
Auto Trait Implementations§
impl<'ctx, 'builder> !RefUnwindSafe for NestedLoadBuilder<'ctx, 'builder>
impl<'ctx, 'builder> !UnwindSafe for NestedLoadBuilder<'ctx, 'builder>
impl<'ctx, 'builder> Freeze for NestedLoadBuilder<'ctx, 'builder>
impl<'ctx, 'builder> Send for NestedLoadBuilder<'ctx, 'builder>
impl<'ctx, 'builder> Sync for NestedLoadBuilder<'ctx, 'builder>
impl<'ctx, 'builder> Unpin for NestedLoadBuilder<'ctx, 'builder>
impl<'ctx, 'builder> UnsafeUnpin for NestedLoadBuilder<'ctx, 'builder>
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
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.