Struct rafx_framework::RenderResources
source · 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 !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.