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>,
) -> SavedAssetBuilder<'a>
pub fn new( asset_server: AssetServer, asset_path: AssetPath<'static>, ) -> SavedAssetBuilder<'a>
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>(
&mut self,
label: impl Into<CowArc<'b, str>>,
asset: SavedAsset<'a, 'a, A>,
) -> Handle<A>where
'b: 'a,
A: Asset,
pub fn add_labeled_asset_with_new_handle<'b, A>(
&mut self,
label: impl Into<CowArc<'b, str>>,
asset: SavedAsset<'a, 'a, A>,
) -> Handle<A>where
'b: 'a,
A: Asset,
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>(
&mut self,
label: impl Into<CowArc<'b, str>>,
asset: SavedAsset<'a, 'a, A>,
handle: Handle<A>,
)where
'b: 'a,
A: Asset,
pub fn add_labeled_asset_with_existing_handle<'b, A>(
&mut self,
label: impl Into<CowArc<'b, str>>,
asset: SavedAsset<'a, 'a, A>,
handle: Handle<A>,
)where
'b: 'a,
A: Asset,
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>(
&mut self,
label: impl Into<CowArc<'b, str>>,
asset: ErasedSavedAsset<'a, 'a>,
) -> UntypedHandlewhere
'b: 'a,
pub fn add_labeled_asset_with_new_handle_erased<'b>(
&mut self,
label: impl Into<CowArc<'b, str>>,
asset: ErasedSavedAsset<'a, 'a>,
) -> UntypedHandlewhere
'b: 'a,
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>(
&mut self,
label: impl Into<CowArc<'b, str>>,
asset: ErasedSavedAsset<'a, 'a>,
handle: UntypedHandle,
)where
'b: 'a,
pub fn add_labeled_asset_with_existing_handle_erased<'b>(
&mut self,
label: impl Into<CowArc<'b, str>>,
asset: ErasedSavedAsset<'a, 'a>,
handle: UntypedHandle,
)where
'b: 'a,
Same as Self::add_labeled_asset_with_existing_handle, but type-erased to allow for
dynamic types.
Sourcepub fn build<'b, A>(self, asset: &'b A) -> SavedAsset<'b, 'b, A>where
'a: 'b,
A: Asset,
pub fn build<'b, A>(self, asset: &'b A) -> SavedAsset<'b, 'b, A>where
'a: 'b,
A: Asset,
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, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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