Struct dotrix_core::assets::Assets [−][src]
pub struct Assets { /* fields omitted */ }
Expand description
Assets management service
Stored asset can be identified by its Id
. The Id
is being assigned to an asset, once
the asset is stored.
File operations performed by the service are being executed in separate threads, so no execution blocking happens. Due to some resources may contain several assets, they may not be loaded at the same time. Also bigger assets may take longer time to be loaded.
There is a way to aquire asset Id
immediately without awaiting using Assets::register
method.
Implementations
Associates an asset name with Id
and returns it
If name was already used, then no changes will be done and already associated Id
will
be returned.
As it was said, names of assets loaded with Assets::import
method can be predictable
in most cases. Using that prediction, developer can obtain an Id
even before calling
the Assets::import
method.
use dotrix_core::{
assets::Texture,
ecs::Mut,
services::Assets,
};
fn my_system(mut assets: Mut<Assets>) {
// get the id
let texture = assets.register::<Texture>("my_texture");
// import the texture
assets.import("/path/to/my_texture.png");
}
Stores an asset under user defined name and returns Id
of it
Stores an asset and returns Id
of it
Searches for an asset by the name and return Id
of it if the asset exists
Searches an asset by its Id
and returns it by a reference if the asset exists
Searches an asset by its Id
and returns it by a mutual reference if the asset exists
Removes an asset from the Service and returns it if the asset exists
Returns iterator over assets by its type
Returns mutable iterator over assets by its type
Trait Implementations
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more