[−][src]Crate goods
Goods
Easy-to-use asset manager for many environments.
Goals
This crate is written with following goals in mind:
-
Batteries included.
Crate comes with variety of simple data sources likeFileSource
andHttpSource
. FewFormat
s based on serde are included under feature flags. -
Extensibility.
MultipleFormat
traits can be implemented for any asset type, including foreign asset types.
For exampleJsonFormat
,YamlFormat
andRonFormat
(bundled in the crate) implementFormat
trait for any asset type which intermediate representation implementsserde::de::DeserializeOwned
. -
Supporting WebAssembly.
All mandatory dependencies are WASM-compatible and no threading is required for asset loading to work. -
Working with asynchronous data sources.
All data sources implementSource
trait.Source::read
method returns future that will be driven to completion by the boundLoader
. -
no_std
alloc
is required. -
Fast compilation.
build aftercargo clean
takes ~3s.
Non-Goals
This crate is not aimed to support every possible feature. Here's list of some of those features:
- Hot-reloading
Currently there are no plans to support hot-reloading.
Structs
Cache | Asset cache. This type is main entry point for asset loading. Caches loaded assets and provokes loading work for new assets. |
FileSource | feature="fs" Asset source that treats asset key as relative file path, joins it with root path and loads asset data from file. |
Handle | Handle for an asset of type |
JsonFormat | feature="json-format" Format that treats bytes as JSON document and deserializes asset representation with |
PhantomContext | Dummy context for assets that doesn't require one. |
Registry | Collection of registered sources.
Used by |
RegistryBuilder | Builder for source registry. |
ReqwestSource | feature="reqwest" Asset source that treats asset key as URL and fetches data from it.
Based on |
RonFormat | feature="ron-format" Format that treats bytes as RON document and deserializes asset representation with |
SpawnError | |
YamlFormat | feature="yaml-format" Format that treats bytes as YAML document and deserializes asset representation with |
Enums
Error | Error occured in process of asset loading. |
SourceError | Error type for |
Traits
Asset | Loaded, processed and prepared asset.
This trait specifies how asset instances can be built from intermediate values
that are produced by |
AssetDefaultFormat | Default format for given asset type. |
Format | Format trait interprets raw bytes as an asset.
It may also use context for asset instance creation
and |
LeafFormat | Trait for formats that loads assets immediately. |
SimpleAsset | Simplified asset trait to reduce boilerplace when implementing simple assets. |
Source | Asset data source. |
Spawn | |
SyncAsset |