Loads only good assets.
This crate is written with following goals in mind:
FileSource
and HttpSource
.
Few Format
s based on serde are included under feature flags.Format
traits can be implemented for any asset type, including foreign asset types.\
For example JsonFormat
, YamlFormat
and RonFormat
(bundled in the crate) implement Format
trait for any asset type
which intermediate representation implements serde::de::DeserializeOwned
.Source
trait.
Source::read
method returns future that will be driven to completion by the bound Loader
.alloc
is required.cargo clean
takes ~3s.This crate is not aimed to support every possible feature. Here's list of some of those features:
All out-of-the-box functionality execut core traits and types are enabled with features.
std
- adds implementation of std::error::Error
trait for error types.fs
(enables std
) - adds FileSource
- Source
implementation that loads asset bytes from file-system.reqwest
- adds ReqwestSource
- Source
implementation that loads asset bytes from URLs using reqwest
.
Using this source requires Loader
to be polled by tokio
. Otherwise reqwest
interals will panic.json-format
- adds Format
implementation that treats asset bytes as JSON document and deserializes asset representation via serdeyaml-format
- adds Format
implementation that treats asset bytes as YAML document and deserializes asset representation via serderon-format
- adds Format
implementation that treats asset bytes as RON document and deserializes asset representation via serdeThere are few simple examples provided already.
fs examlple - shows how to build registry with FileSource
and load simple assets from it.
reqwest example - async example that loads assets from localhost
over HTTP using tokio
and reqwest
crates.
legion example - shows how to load assets into entity using legion
ECS crate.
This repository is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.