pub struct UntypedResources { /* private fields */ }Expand description
Implementations§
Source§impl UntypedResources
impl UntypedResources
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty UntypedResources.
Sourcepub 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.
Sourcepub 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.
Sourcepub fn insert_cell(
&self,
cell: AtomicUntypedResource,
) -> Result<(), CellAlreadyPresentError>
pub fn insert_cell( &self, cell: AtomicUntypedResource, ) -> 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.
Sourcepub fn get(&self, schema: &'static Schema) -> &UntypedResource
pub fn get(&self, schema: &'static Schema) -> &UntypedResource
Borrow the resource for the given schema.
Sourcepub fn get_cell(&self, schema: &'static Schema) -> AtomicUntypedResource
pub fn get_cell(&self, schema: &'static Schema) -> AtomicUntypedResource
Get a cell for the resource with the given schema.
Sourcepub 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.
Sourcepub 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.
Sourcepub fn clear_owned_resources(&self)
pub fn clear_owned_resources(&self)
Removes all resourcse that are not shared resources.
Trait Implementations§
Source§impl Clone for UntypedResources
impl Clone for UntypedResources
Source§impl Default for UntypedResources
impl Default for UntypedResources
Source§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,
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &World) -> T
fn from_world(_world: &World) -> T
Self using data from the given World.