pub struct Resources { /* private fields */ }Expand description
A collection of resources.
Resources is essentially a type-map
Implementations§
Source§impl Resources
impl Resources
Sourcepub fn insert<T>(&mut self, resource: T)where
T: TypedEcsData,
pub fn insert<T>(&mut self, resource: T)where
T: TypedEcsData,
Sourcepub fn try_insert<T>(&mut self, resource: T) -> Result<(), EcsError>where
T: TypedEcsData,
pub fn try_insert<T>(&mut self, resource: T) -> Result<(), EcsError>where
T: TypedEcsData,
Sourcepub fn get<T>(&self) -> AtomicResource<T>where
T: TypedEcsData,
pub fn get<T>(&self) -> AtomicResource<T>where
T: TypedEcsData,
Get a resource handle from the store.
This is not the resource itself, but a handle, may be cloned cheaply.
In order to access the resource you must call borrow() or
borrow_mut() on the returned value.
§Panics
Panics if the resource does not exist in the store.
Sourcepub fn contains<T>(&self) -> boolwhere
T: TypedEcsData,
pub fn contains<T>(&self) -> boolwhere
T: TypedEcsData,
Check whether or not a resource is in the store.
See get()
Sourcepub fn try_get<T>(&self) -> Option<AtomicResource<T>>where
T: TypedEcsData,
pub fn try_get<T>(&self) -> Option<AtomicResource<T>>where
T: TypedEcsData,
Gets a resource handle from the store if it exists.
Sourcepub fn untyped(&self) -> &UntypedResources
pub fn untyped(&self) -> &UntypedResources
Borrow the underlying UntypedResources store.
Sourcepub fn untyped_mut(&mut self) -> &mut UntypedResources
pub fn untyped_mut(&mut self) -> &mut UntypedResources
Mutably borrow the underlying UntypedResources store.
Sourcepub fn into_untyped(self) -> UntypedResources
pub fn into_untyped(self) -> UntypedResources
Consume Resources and extract the underlying UntypedResources.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Resources
impl !RefUnwindSafe for Resources
impl Send for Resources
impl Sync for Resources
impl Unpin for Resources
impl !UnwindSafe for Resources
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates
Self using data from the given World.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more