pub struct RenderResources { /* private fields */ }
Expand description
A key-value structure. The key is a type, and the value is a single object of that type
Implementations§
Source§impl ResourceMap
impl ResourceMap
Sourcepub fn new() -> ResourceMap
pub fn new() -> ResourceMap
Creates an empty resource map
pub fn try_insert_default<R>(&mut self)
Sourcepub fn remove<R>(&mut self) -> Option<R>where
R: Resource,
pub fn remove<R>(&mut self) -> Option<R>where
R: Resource,
Remove a type/resource instance from the map
Sourcepub fn fetch<R>(&self) -> ReadBorrow<'_, R>where
R: Resource,
pub fn fetch<R>(&self) -> ReadBorrow<'_, R>where
R: Resource,
Read-only fetch of a resource. Trying to get a resource that is not in the map is fatal. Use try_fetch if unsure whether the resource exists. Requesting read access to a resource that has any concurrently active writer is fatal.
Sourcepub fn try_fetch<R>(&self) -> Option<ReadBorrow<'_, R>>where
R: Resource,
pub fn try_fetch<R>(&self) -> Option<ReadBorrow<'_, R>>where
R: Resource,
Read-only fetch of a resource. Requesting read access to a resource that has a concurrently active writer is fatal. Returns None if the type is not registered.
Sourcepub fn fetch_mut<R>(&self) -> WriteBorrow<'_, R>where
R: Resource,
pub fn fetch_mut<R>(&self) -> WriteBorrow<'_, R>where
R: Resource,
Read/Write fetch of a resource. Trying to get a resource that is not in the map is fatal. Use try_fetch if unsure whether the resource exists. Requesting write access to a resource with any concurrently active read/write is fatal
Sourcepub fn try_fetch_mut<R>(&self) -> Option<WriteBorrow<'_, R>>where
R: Resource,
pub fn try_fetch_mut<R>(&self) -> Option<WriteBorrow<'_, R>>where
R: Resource,
Read/Write fetch of a resource. Requesting write access to a resource with any concurrently active read/write is fatal. Returns None if the type is not registered.
Sourcepub fn has_value<R>(&self) -> boolwhere
R: Resource,
pub fn has_value<R>(&self) -> boolwhere
R: Resource,
Returns true if the resource is registered.
Sourcepub fn keys(&self) -> impl Iterator<Item = &ResourceId>
pub fn keys(&self) -> impl Iterator<Item = &ResourceId>
Iterate all ResourceIds within the dictionary
Trait Implementations§
Source§impl Default for ResourceMap
impl Default for ResourceMap
Source§fn default() -> ResourceMap
fn default() -> ResourceMap
Auto Trait Implementations§
impl Freeze for ResourceMap
impl !RefUnwindSafe for ResourceMap
impl Send for ResourceMap
impl Sync for ResourceMap
impl Unpin for ResourceMap
impl !UnwindSafe for ResourceMap
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.