Struct bevy::asset::io::AssetSourceBuilder
pub struct AssetSourceBuilder {
pub reader: Option<Box<dyn FnMut() -> Box<dyn AssetReader> + Sync + Send>>,
pub writer: Option<Box<dyn FnMut() -> Option<Box<dyn AssetWriter>> + Sync + Send>>,
pub watcher: Option<Box<dyn FnMut(Sender<AssetSourceEvent>) -> Option<Box<dyn AssetWatcher>> + Sync + Send>>,
pub processed_reader: Option<Box<dyn FnMut() -> Box<dyn AssetReader> + Sync + Send>>,
pub processed_writer: Option<Box<dyn FnMut() -> Option<Box<dyn AssetWriter>> + Sync + Send>>,
pub processed_watcher: Option<Box<dyn FnMut(Sender<AssetSourceEvent>) -> Option<Box<dyn AssetWatcher>> + Sync + Send>>,
}
Expand description
Metadata about an “asset source”, such as how to construct the AssetReader
and AssetWriter
for the source,
and whether or not the source is processed.
Fields§
§reader: Option<Box<dyn FnMut() -> Box<dyn AssetReader> + Sync + Send>>
§writer: Option<Box<dyn FnMut() -> Option<Box<dyn AssetWriter>> + Sync + Send>>
§watcher: Option<Box<dyn FnMut(Sender<AssetSourceEvent>) -> Option<Box<dyn AssetWatcher>> + Sync + Send>>
§processed_reader: Option<Box<dyn FnMut() -> Box<dyn AssetReader> + Sync + Send>>
§processed_writer: Option<Box<dyn FnMut() -> Option<Box<dyn AssetWriter>> + Sync + Send>>
§processed_watcher: Option<Box<dyn FnMut(Sender<AssetSourceEvent>) -> Option<Box<dyn AssetWatcher>> + Sync + Send>>
Implementations§
§impl AssetSourceBuilder
impl AssetSourceBuilder
pub fn build(
&mut self,
id: AssetSourceId<'static>,
watch: bool,
watch_processed: bool
) -> Option<AssetSource>
pub fn build( &mut self, id: AssetSourceId<'static>, watch: bool, watch_processed: bool ) -> Option<AssetSource>
Builds a new AssetSource
with the given id
. If watch
is true, the unprocessed source will watch for changes.
If watch_processed
is true, the processed source will watch for changes.
pub fn with_reader(
self,
reader: impl FnMut() -> Box<dyn AssetReader> + Send + Sync + 'static
) -> AssetSourceBuilder
pub fn with_reader( self, reader: impl FnMut() -> Box<dyn AssetReader> + Send + Sync + 'static ) -> AssetSourceBuilder
Will use the given reader
function to construct unprocessed AssetReader
instances.
pub fn with_writer(
self,
writer: impl FnMut() -> Option<Box<dyn AssetWriter>> + Send + Sync + 'static
) -> AssetSourceBuilder
pub fn with_writer( self, writer: impl FnMut() -> Option<Box<dyn AssetWriter>> + Send + Sync + 'static ) -> AssetSourceBuilder
Will use the given writer
function to construct unprocessed AssetWriter
instances.
pub fn with_watcher(
self,
watcher: impl FnMut(Sender<AssetSourceEvent>) -> Option<Box<dyn AssetWatcher>> + Send + Sync + 'static
) -> AssetSourceBuilder
pub fn with_watcher( self, watcher: impl FnMut(Sender<AssetSourceEvent>) -> Option<Box<dyn AssetWatcher>> + Send + Sync + 'static ) -> AssetSourceBuilder
Will use the given watcher
function to construct unprocessed AssetWatcher
instances.
pub fn with_processed_reader(
self,
reader: impl FnMut() -> Box<dyn AssetReader> + Send + Sync + 'static
) -> AssetSourceBuilder
pub fn with_processed_reader( self, reader: impl FnMut() -> Box<dyn AssetReader> + Send + Sync + 'static ) -> AssetSourceBuilder
Will use the given reader
function to construct processed AssetReader
instances.
pub fn with_processed_writer(
self,
writer: impl FnMut() -> Option<Box<dyn AssetWriter>> + Send + Sync + 'static
) -> AssetSourceBuilder
pub fn with_processed_writer( self, writer: impl FnMut() -> Option<Box<dyn AssetWriter>> + Send + Sync + 'static ) -> AssetSourceBuilder
Will use the given writer
function to construct processed AssetWriter
instances.
pub fn with_processed_watcher(
self,
watcher: impl FnMut(Sender<AssetSourceEvent>) -> Option<Box<dyn AssetWatcher>> + Send + Sync + 'static
) -> AssetSourceBuilder
pub fn with_processed_watcher( self, watcher: impl FnMut(Sender<AssetSourceEvent>) -> Option<Box<dyn AssetWatcher>> + Send + Sync + 'static ) -> AssetSourceBuilder
Will use the given watcher
function to construct processed AssetWatcher
instances.
pub fn platform_default(
path: &str,
processed_path: Option<&str>
) -> AssetSourceBuilder
pub fn platform_default( path: &str, processed_path: Option<&str> ) -> AssetSourceBuilder
Returns a builder containing the “platform default source” for the given path
and processed_path
.
For most platforms, this will use FileAssetReader
/ FileAssetWriter
,
but some platforms (such as Android) have their own default readers / writers / watchers.
Trait Implementations§
§impl Default for AssetSourceBuilder
impl Default for AssetSourceBuilder
§fn default() -> AssetSourceBuilder
fn default() -> AssetSourceBuilder
Auto Trait Implementations§
impl !RefUnwindSafe for AssetSourceBuilder
impl Send for AssetSourceBuilder
impl Sync for AssetSourceBuilder
impl Unpin for AssetSourceBuilder
impl !UnwindSafe for AssetSourceBuilder
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere U: ShaderType, &'a T: for<'a> Into<U>,
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> 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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§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
.§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
.§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.§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.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World
.