Struct bones_lib::ecs::resources::UntypedResourceSet
pub struct UntypedResourceSet { /* private fields */ }
Expand description
Utility container for storing set of UntypedResource
.
Cloning
Implementations§
§impl UntypedResourceSet
impl UntypedResourceSet
pub fn insert_resource<T>(&mut self, resource: T)where
T: HasSchema,
pub fn insert_resource<T>(&mut self, resource: T)where
T: HasSchema,
Insert a startup resource. On stage / session startup (first step), will be inserted into World
.
If already exists, will be overwritten.
pub fn init_resource<T>(&mut self) -> RefMut<'_, T>
pub fn init_resource<T>(&mut self) -> RefMut<'_, T>
Init resource with default, and return mutable ref for modification. If already exists, returns mutable ref to existing resource.
pub fn resource_mut<T>(&self) -> Option<RefMut<'_, T>>where
T: HasSchema,
pub fn resource_mut<T>(&self) -> Option<RefMut<'_, T>>where
T: HasSchema,
Get mutable reference to startup resource if found.
pub fn insert_empty<T>(&mut self)where
T: HasSchema,
pub fn insert_empty<T>(&mut self)where
T: HasSchema,
Insert an UntypedResource
with empty cell for [Schema
] of T
.
If resource already exists for this schema, overwrite it with empty.
pub fn resources(&self) -> &Vec<UntypedResource>
pub fn resources(&self) -> &Vec<UntypedResource>
Get immutable ref to Vec of resources
pub fn insert_on_world(&self, world: &mut World, remove_empty: bool)
pub fn insert_on_world(&self, world: &mut World, remove_empty: bool)
Insert resources in world. If resource already exists, overwrites it.
If remove_empty
is set, if resource cell is empty, it will remove the
resource from cell on world.
Trait Implementations§
§impl Clone for UntypedResourceSet
impl Clone for UntypedResourceSet
§fn clone(&self) -> UntypedResourceSet
fn clone(&self) -> UntypedResourceSet
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Default for UntypedResourceSet
impl Default for UntypedResourceSet
§fn default() -> UntypedResourceSet
fn default() -> UntypedResourceSet
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for UntypedResourceSet
impl !RefUnwindSafe for UntypedResourceSet
impl Send for UntypedResourceSet
impl Sync for UntypedResourceSet
impl Unpin for UntypedResourceSet
impl !UnwindSafe for UntypedResourceSet
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§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
Creates
Self
using data from the given World
.