pub struct SavedAssetBuilder<'a> { /* private fields */ }Expand description
A builder for creating SavedAsset instances (for use with asset saving).
This is commonly used in tandem with save_using_saver.
Implementations§
Source§impl<'a> SavedAssetBuilder<'a>
impl<'a> SavedAssetBuilder<'a>
Sourcepub fn new(asset_server: AssetServer, asset_path: AssetPath<'static>) -> Self
pub fn new(asset_server: AssetServer, asset_path: AssetPath<'static>) -> Self
Creates a new builder for the given asset_path and using the asset_server to back its
handles.
Sourcepub fn add_labeled_asset_with_new_handle<'b: 'a, A: Asset>(
&mut self,
label: impl Into<CowArc<'b, str>>,
asset: SavedAsset<'a, 'a, A>,
) -> Handle<A>
pub fn add_labeled_asset_with_new_handle<'b: 'a, A: Asset>( &mut self, label: impl Into<CowArc<'b, str>>, asset: SavedAsset<'a, 'a, A>, ) -> Handle<A>
Adds a labeled asset, creates a handle for it, and returns the handle (for use in creating an asset).
This is primarily used when constructing a new asset to be saved. Since assets commonly store handles to their subassets, this function returns a handle that can be stored in your root asset.
If you already have a root asset instance (which already contains a subasset handle), use
Self::add_labeled_asset_with_existing_handle instead.
Sourcepub fn add_labeled_asset_with_existing_handle<'b: 'a, A: Asset>(
&mut self,
label: impl Into<CowArc<'b, str>>,
asset: SavedAsset<'a, 'a, A>,
handle: Handle<A>,
)
pub fn add_labeled_asset_with_existing_handle<'b: 'a, A: Asset>( &mut self, label: impl Into<CowArc<'b, str>>, asset: SavedAsset<'a, 'a, A>, handle: Handle<A>, )
Adds a labeled asset with a pre-existing handle.
This is primarily used when attempting to save a (root) asset that you already have an instance of. Since this root asset instance already must have its fields populated (including any subasset handles), this function allows you to record the subasset that should be associated with that handle.
If you do not have a root asset instance (you’re creating one from scratch), use
Self::add_labeled_asset_with_new_handle instead.
Sourcepub fn add_labeled_asset_with_new_handle_erased<'b: 'a>(
&mut self,
label: impl Into<CowArc<'b, str>>,
asset: ErasedSavedAsset<'a, 'a>,
) -> UntypedHandle
pub fn add_labeled_asset_with_new_handle_erased<'b: 'a>( &mut self, label: impl Into<CowArc<'b, str>>, asset: ErasedSavedAsset<'a, 'a>, ) -> UntypedHandle
Same as Self::add_labeled_asset_with_new_handle, but type-erased to allow for dynamic
types.
Sourcepub fn add_labeled_asset_with_existing_handle_erased<'b: 'a>(
&mut self,
label: impl Into<CowArc<'b, str>>,
asset: ErasedSavedAsset<'a, 'a>,
handle: UntypedHandle,
)
pub fn add_labeled_asset_with_existing_handle_erased<'b: 'a>( &mut self, label: impl Into<CowArc<'b, str>>, asset: ErasedSavedAsset<'a, 'a>, handle: UntypedHandle, )
Same as Self::add_labeled_asset_with_existing_handle, but type-erased to allow for
dynamic types.
Sourcepub fn build<'b, A: Asset>(self, asset: &'b A) -> SavedAsset<'b, 'b, A>where
'a: 'b,
pub fn build<'b, A: Asset>(self, asset: &'b A) -> SavedAsset<'b, 'b, A>where
'a: 'b,
Creates the final saved asset from this builder.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for SavedAssetBuilder<'a>
impl<'a> !UnwindSafe for SavedAssetBuilder<'a>
impl<'a> Freeze for SavedAssetBuilder<'a>
impl<'a> Send for SavedAssetBuilder<'a>
impl<'a> Sync for SavedAssetBuilder<'a>
impl<'a> Unpin for SavedAssetBuilder<'a>
impl<'a> UnsafeUnpin for SavedAssetBuilder<'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
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.