pub struct Resources { /* private fields */ }Expand description
Type-keyed singleton storage: one value per resource type.
Implementations§
Source§impl Resources
impl Resources
Sourcepub fn insert<T>(&mut self, value: T) -> Option<T>
pub fn insert<T>(&mut self, value: T) -> Option<T>
Insert a resource, returning the previous instance of the same type if one was present. Replaces in place when the type is already present, so a per-frame republish reuses the existing allocation.
Sourcepub fn get<T>(&self) -> Option<&T>where
T: Any,
pub fn get<T>(&self) -> Option<&T>where
T: Any,
Borrow the resource of type T, if one is present.
Sourcepub fn get_mut<T>(&mut self) -> Option<&mut T>where
T: Any,
pub fn get_mut<T>(&mut self) -> Option<&mut T>where
T: Any,
Mutably borrow the resource of type T, if one is present.
Sourcepub fn remove<T>(&mut self) -> Option<T>where
T: Any,
pub fn remove<T>(&mut self) -> Option<T>where
T: Any,
Remove and return the resource of type T, if one is present.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Resources
impl !Sync for Resources
impl !UnwindSafe for Resources
impl Freeze for Resources
impl Send for Resources
impl Unpin for Resources
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().