Struct bevy::prelude::Assets[]

pub struct Assets<T> where
    T: Asset
{ /* fields omitted */ }

Stores Assets of a given type and tracks changes to them.

Implementations

impl<T> Assets<T> where
    T: Asset

pub fn add(&mut self, asset: T) -> Handle<T>

#[must_use = "not using the returned strong handle may result in the unexpected release of the asset"]pub fn set<H>(&mut self, handle: H, asset: T) -> Handle<T> where
    H: Into<HandleId>, 

pub fn set_untracked<H>(&mut self, handle: H, asset: T) where
    H: Into<HandleId>, 

pub fn get<H>(&self, handle: H) -> Option<&T> where
    H: Into<HandleId>, 

pub fn contains<H>(&self, handle: H) -> bool where
    H: Into<HandleId>, 

pub fn get_mut<H>(&mut self, handle: H) -> Option<&mut T> where
    H: Into<HandleId>, 

pub fn get_handle<H>(&self, handle: H) -> Handle<T> where
    H: Into<HandleId>, 

pub fn get_or_insert_with<H>(
    &mut self,
    handle: H,
    insert_fn: impl FnOnce() -> T
) -> &mut T where
    H: Into<HandleId>, 

pub fn iter(&self) -> impl Iterator<Item = (HandleId, &T)>

pub fn ids(&self) -> impl Iterator<Item = HandleId>

pub fn remove<H>(&mut self, handle: H) -> Option<T> where
    H: Into<HandleId>, 

pub fn clear(&mut self)

Clears the inner asset map, removing all key-value pairs.

Keeps the allocated memory for reuse.

pub fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more elements to be inserted into the assets.

The collection may reserve more space to avoid frequent reallocations.

pub fn shrink_to_fit(&mut self)

Shrinks the capacity of the asset map as much as possible.

It will drop down as much as possible while maintaining the internal rules and possibly leaving some space in accordance with the resize policy.

pub fn asset_event_system(
    events: EventWriter<'_, AssetEvent<T>>,
    assets: ResMut<'_, Assets<T>>
)

pub fn len(&self) -> usize

pub fn is_empty(&self) -> bool

Trait Implementations

impl<T> Debug for Assets<T> where
    T: Debug + Asset

Auto Trait Implementations

impl<T> RefUnwindSafe for Assets<T> where
    T: RefUnwindSafe

impl<T> Send for Assets<T>

impl<T> Sync for Assets<T>

impl<T> Unpin for Assets<T> where
    T: Unpin

impl<T> UnwindSafe for Assets<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Component for T where
    T: 'static + Send + Sync

impl<T> Downcast for T where
    T: Any

impl<T> Downcast<T> for T

impl<T> DowncastSync for T where
    T: Any + Send + Sync

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Upcast<T> for T

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,