[−][src]Trait amethyst_assets::Format
A format, providing a conversion from bytes to asset data, which is then
in turn accepted by Asset::from_data
. Examples for formats are
Png
, Obj
and Wave
.
The format type itself represents loading options, which are passed to import
.
E.g. for textures this would be stuff like mipmap levels and
sampler info.
Required methods
Loading content...Provided methods
fn import_simple(&self, _bytes: Vec<u8>) -> Result<D, Error>
Produces asset data from given bytes.
This method is a simplified version of format
.
This format assumes that the asset name is the full path and the asset is only
contained in one file.
If you are implementing format
yourself, this method will never be used
and can be left unimplemented.
fn import(
&self,
name: String,
source: Arc<dyn Source>,
create_reload: Option<Box<dyn Format<D>>>
) -> Result<FormatValue<D>, Error>
&self,
name: String,
source: Arc<dyn Source>,
create_reload: Option<Box<dyn Format<D>>>
) -> Result<FormatValue<D>, Error>
Reads the given bytes and produces asset data.
You can implement import_simple
instead of simpler formats.
Reload
The reload structure has metadata which allows the asset management
to reload assets if necessary (for hot reloading).
You should only create Reload
when create_reload
is Some
.
Also, the parameter is just a request, which means it's optional either way.
Implementations on Foreign Types
impl<D: 'static> Format<D> for Box<dyn Format<D>>
[src]
fn name(&self) -> &'static str
[src]
fn import_simple(&self, bytes: Vec<u8>) -> Result<D, Error>
[src]
fn import(
&self,
name: String,
source: Arc<dyn Source>,
create_reload: Option<Box<dyn Format<D>>>
) -> Result<FormatValue<D>, Error>
[src]
&self,
name: String,
source: Arc<dyn Source>,
create_reload: Option<Box<dyn Format<D>>>
) -> Result<FormatValue<D>, Error>
impl<D: 'static> Format<D> for Box<dyn SerializableFormat<D>>
[src]
fn name(&self) -> &'static str
[src]
fn import_simple(&self, bytes: Vec<u8>) -> Result<D, Error>
[src]
fn import(
&self,
name: String,
source: Arc<dyn Source>,
create_reload: Option<Box<dyn Format<D>>>
) -> Result<FormatValue<D>, Error>
[src]
&self,
name: String,
source: Arc<dyn Source>,
create_reload: Option<Box<dyn Format<D>>>
) -> Result<FormatValue<D>, Error>
Implementors
impl<D> Format<D> for RonFormat where
D: for<'a> Deserialize<'a> + Send + Sync + 'static,
[src]
D: for<'a> Deserialize<'a> + Send + Sync + 'static,