pub struct Assets<A: Asset> { /* private fields */ }Expand description
A central, in-memory cache for a specific type of asset A.
This structure maps a unique AssetUUID to a shared AssetHandle<A>.
This ensures that any given asset is loaded only once. Subsequent requests
for the same asset will receive a clone of the cached handle.
Implementations§
Source§impl<A: Asset> Assets<A>
impl<A: Asset> Assets<A>
Sourcepub fn insert(&mut self, uuid: AssetUUID, handle: AssetHandle<A>)
pub fn insert(&mut self, uuid: AssetUUID, handle: AssetHandle<A>)
Inserts an asset handle into the storage, associated with its UUID. If an asset with the same UUID already exists, it will be replaced. This operation is always successful.
§Arguments
uuid- The unique identifier for the asset.handle- The handle to the asset to be stored.
Trait Implementations§
Auto Trait Implementations§
impl<A> Freeze for Assets<A>
impl<A> RefUnwindSafe for Assets<A>where
A: RefUnwindSafe,
impl<A> Send for Assets<A>
impl<A> Sync for Assets<A>
impl<A> Unpin for Assets<A>
impl<A> UnwindSafe for Assets<A>where
A: RefUnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more