pub struct SavedAsset<'a, 'b, A: Asset> { /* private fields */ }Expand description
An Asset (and any labeled “sub assets”) intended to be saved.
Implementations§
Source§impl<'a, 'b, A: Asset> SavedAsset<'a, 'b, A>
impl<'a, 'b, A: Asset> SavedAsset<'a, 'b, A>
Sourcepub fn from_loaded(asset: &'a ErasedLoadedAsset) -> Option<Self>
pub fn from_loaded(asset: &'a ErasedLoadedAsset) -> Option<Self>
Creates a new SavedAsset from asset if its internal value matches A.
Sourcepub fn from_transformed(asset: &'a TransformedAsset<A>) -> Self
pub fn from_transformed(asset: &'a TransformedAsset<A>) -> Self
Creates a new SavedAsset from the a TransformedAsset
Sourcepub fn from_asset(value: &'a A) -> Self
pub fn from_asset(value: &'a A) -> Self
Creates a new SavedAsset holding only the provided value with no labeled assets.
Sourcepub fn upcast(self) -> ErasedSavedAsset<'a, 'a>where
'b: 'a,
pub fn upcast(self) -> ErasedSavedAsset<'a, 'a>where
'b: 'a,
Casts this typed asset into its type-erased form.
Sourcepub fn get_labeled<B: Asset>(
&self,
label: impl AsRef<str>,
) -> Option<SavedAsset<'a, '_, B>>
pub fn get_labeled<B: Asset>( &self, label: impl AsRef<str>, ) -> Option<SavedAsset<'a, '_, B>>
Returns the labeled asset, if it exists and matches this type.
Sourcepub fn get_erased_labeled(
&self,
label: impl AsRef<str>,
) -> Option<&ErasedSavedAsset<'a, '_>>
pub fn get_erased_labeled( &self, label: impl AsRef<str>, ) -> Option<&ErasedSavedAsset<'a, '_>>
Returns the type-erased labeled asset, if it exists and matches this type.
Sourcepub fn get_labeled_by_id<B: Asset>(
&self,
id: impl Into<AssetId<B>>,
) -> Option<SavedAsset<'a, '_, B>>
pub fn get_labeled_by_id<B: Asset>( &self, id: impl Into<AssetId<B>>, ) -> Option<SavedAsset<'a, '_, B>>
Returns the labeled asset given its asset ID if it exists and matches the type.
This can be used to get the asset from its handle since &Handle implements
Into<AssetId<B>>.
Sourcepub fn get_erased_labeled_by_id(
&self,
id: impl Into<UntypedAssetId>,
) -> Option<&ErasedSavedAsset<'a, '_>>
pub fn get_erased_labeled_by_id( &self, id: impl Into<UntypedAssetId>, ) -> Option<&ErasedSavedAsset<'a, '_>>
Returns the type-erased labeled asset given its asset ID if it exists.
This can be used to get the asset from its handle since &UntypedHandle implements
Into<UntypedAssetId>.
Sourcepub fn get_untyped_handle(
&self,
label: impl AsRef<str>,
) -> Option<UntypedHandle>
pub fn get_untyped_handle( &self, label: impl AsRef<str>, ) -> Option<UntypedHandle>
Returns the UntypedHandle of the labeled asset with the provided ‘label’, if it exists.
Sourcepub fn get_handle<B: Asset>(&self, label: impl AsRef<str>) -> Option<Handle<B>>
pub fn get_handle<B: Asset>(&self, label: impl AsRef<str>) -> Option<Handle<B>>
Returns the Handle of the labeled asset with the provided ‘label’, if it exists and is an asset of type B
Sourcepub fn iter_labels(&self) -> impl Iterator<Item = &str>
pub fn iter_labels(&self) -> impl Iterator<Item = &str>
Iterate over all labels for “labeled assets” in the loaded asset
Trait Implementations§
Auto Trait Implementations§
impl<'a, 'b, A> !RefUnwindSafe for SavedAsset<'a, 'b, A>
impl<'a, 'b, A> !UnwindSafe for SavedAsset<'a, 'b, A>
impl<'a, 'b, A> Freeze for SavedAsset<'a, 'b, A>
impl<'a, 'b, A> Send for SavedAsset<'a, 'b, A>
impl<'a, 'b, A> Sync for SavedAsset<'a, 'b, A>
impl<'a, 'b, A> Unpin for SavedAsset<'a, 'b, A>
impl<'a, 'b, A> UnsafeUnpin for SavedAsset<'a, 'b, 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.