Struct UntypedResources
pub struct UntypedResources { /* private fields */ }Expand description
Implementations§
§impl UntypedResources
impl UntypedResources
pub fn new() -> UntypedResources
pub fn new() -> UntypedResources
Create an empty UntypedResources.
pub fn contains_cell(&self, id: SchemaId) -> bool
pub fn contains_cell(&self, id: SchemaId) -> bool
Check whether or not a cell for the given resource has been initialized yet.
pub fn contains(&self, id: SchemaId) -> bool
pub fn contains(&self, id: SchemaId) -> bool
Check whether or not the resource with the given ID is present.
pub fn insert_cell(
&self,
cell: Arc<UntypedResource>,
) -> Result<(), CellAlreadyPresentError>
pub fn insert_cell( &self, cell: Arc<UntypedResource>, ) -> Result<(), CellAlreadyPresentError>
This is an advanced use-case function that allows you to insert a resource cell directly.
Normally this is completely unnecessary, because cells are automatically inserted lazily as requested.
Inserting this manually is used internally for shared resources, by inserting the same cell into multiple worlds.
§Errors
This will error if there is already a cell for the resource present. You cannot add a new cell once one has already been inserted.
pub fn get(&self, schema: &'static Schema) -> &UntypedResource
pub fn get(&self, schema: &'static Schema) -> &UntypedResource
Borrow the resource for the given schema.
pub fn get_cell(&self, schema: &'static Schema) -> Arc<UntypedResource>
pub fn get_cell(&self, schema: &'static Schema) -> Arc<UntypedResource>
Get a cell for the resource with the given schema.
pub fn retain_resources<F>(&self, predicate: F)
pub fn retain_resources<F>(&self, predicate: F)
Iterates through owned and shared resource cells removing them if the predicate returns false.
See also: Self::retain_owned_resources.
pub fn retain_owned_resources<F>(&self, predicate: F)
pub fn retain_owned_resources<F>(&self, predicate: F)
Iterates through resource cells removing them if the predicate returns false.
Doesn’t include shared resources. See also: Self::retain_resources.
pub fn clear_owned_resources(&self)
pub fn clear_owned_resources(&self)
Removes all resourcse that are not shared resources.
Trait Implementations§
§impl Clone for UntypedResources
impl Clone for UntypedResources
§fn clone(&self) -> UntypedResources
fn clone(&self) -> UntypedResources
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Default for UntypedResources
impl Default for UntypedResources
§fn default() -> UntypedResources
fn default() -> UntypedResources
Auto Trait Implementations§
impl Freeze for UntypedResources
impl !RefUnwindSafe for UntypedResources
impl Send for UntypedResources
impl Sync for UntypedResources
impl Unpin for UntypedResources
impl !UnwindSafe for UntypedResources
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &World) -> T
fn from_world(_world: &World) -> T
Self using data from the given World.