Struct rafx::base::resource_ref_map::ResourceRefMap
source · pub struct ResourceRefMap<'a> { /* private fields */ }
Expand description
Like ResourceMap, but the insertions are temporary. This is an alternative to making a large
amount of code generic just to pass down an arbitrary
Implementations§
source§impl<'a> ResourceRefMap<'a>
impl<'a> ResourceRefMap<'a>
pub fn new() -> ResourceRefMap<'a>
sourcepub fn insert<R>(&mut self, r: &'a mut R)where
R: Resource,
pub fn insert<R>(&mut self, r: &'a mut R)where
R: Resource,
Add a type/resource instance to the map
sourcepub fn remove<R>(&mut self) -> Option<&'a mut R>where
R: Resource,
pub fn remove<R>(&mut self) -> Option<&'a mut R>where
R: Resource,
Remove a type/resource instance from the map
sourcepub fn fetch<R>(&self) -> ResourceRefBorrow<'_, R>where
R: Resource,
pub fn fetch<R>(&self) -> ResourceRefBorrow<'_, 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<ResourceRefBorrow<'_, R>>where
R: Resource,
pub fn try_fetch<R>(&self) -> Option<ResourceRefBorrow<'_, 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) -> ResourceRefBorrowMut<'_, R>where
R: Resource,
pub fn fetch_mut<R>(&self) -> ResourceRefBorrowMut<'_, 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<ResourceRefBorrowMut<'_, R>>where
R: Resource,
pub fn try_fetch_mut<R>(&self) -> Option<ResourceRefBorrowMut<'_, 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.
Trait Implementations§
source§impl<'a> Default for ResourceRefMap<'a>
impl<'a> Default for ResourceRefMap<'a>
source§fn default() -> ResourceRefMap<'a>
fn default() -> ResourceRefMap<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ResourceRefMap<'a>
impl<'a> Send for ResourceRefMap<'a>
impl<'a> Sync for ResourceRefMap<'a>
impl<'a> Unpin for ResourceRefMap<'a>
impl<'a> !UnwindSafe for ResourceRefMap<'a>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.