pub struct World { /* private fields */ }Implementations§
Source§impl World
impl World
pub fn new() -> Self
pub fn entities(&self) -> Entities<'_>
pub fn create_entity(&mut self) -> Entity
pub fn delete_entity(&mut self, e: Entity) -> Result<(), WrongGeneration>
pub fn insert_resource<R>(&mut self, r: R) -> Option<R>where
R: 'static,
pub fn remove_resource<R>(&mut self) -> Option<R>where
R: 'static,
pub fn contains_resource<T>(&self) -> boolwhere
T: 'static,
Sourcepub fn read_resource<R>(&self) -> ReadResource<'_, R>where
R: 'static,
pub fn read_resource<R>(&self) -> ReadResource<'_, R>where
R: 'static,
Borrow the given resource immutably.
§Panics
Panics if the resource has not been inserted or is already borrowed mutably.
Sourcepub fn write_resource<R>(&self) -> WriteResource<'_, R>where
R: 'static,
pub fn write_resource<R>(&self) -> WriteResource<'_, R>where
R: 'static,
Borrow the given resource mutably.
§Panics
Panics if the resource has not been inserted or is already borrowed.
Sourcepub fn get_resource_mut<R>(&mut self) -> &mut Rwhere
R: 'static,
pub fn get_resource_mut<R>(&mut self) -> &mut Rwhere
R: 'static,
§Panics
Panics if the resource has not been inserted.
Sourcepub fn insert_component<C>(&mut self) -> Option<ComponentStorage<C>>
pub fn insert_component<C>(&mut self) -> Option<ComponentStorage<C>>
Insert a new, fresh storage for the given component.
If the component was already inserted, this will clear the storage for the component first.
Sourcepub fn remove_component<C>(&mut self) -> Option<ComponentStorage<C>>
pub fn remove_component<C>(&mut self) -> Option<ComponentStorage<C>>
Remove storage for the given component.
pub fn contains_component<C>(&self) -> boolwhere
C: Component + 'static,
Sourcepub fn read_component<C>(&self) -> ReadComponent<'_, C>where
C: Component + 'static,
pub fn read_component<C>(&self) -> ReadComponent<'_, C>where
C: Component + 'static,
Borrow the given component immutably.
§Panics
Panics if the component has not been inserted or is already borrowed mutably.
Sourcepub fn write_component<C>(&self) -> WriteComponent<'_, C>where
C: Component + 'static,
pub fn write_component<C>(&self) -> WriteComponent<'_, C>where
C: Component + 'static,
Borrow the given component mutably.
§Panics
Panics if the component has not been inserted or is already borrowed.
Sourcepub fn get_component_mut<C>(
&mut self,
) -> ComponentAccess<'_, C, &mut ComponentStorage<C>>where
C: Component + 'static,
pub fn get_component_mut<C>(
&mut self,
) -> ComponentAccess<'_, C, &mut ComponentStorage<C>>where
C: Component + 'static,
§Panics
Panics if the component has not been inserted.
pub fn fetch<'a, F>(&'a self) -> F
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for World
impl !RefUnwindSafe for World
impl !Send for World
impl !Sync for World
impl Unpin for World
impl UnsafeUnpin for World
impl !UnwindSafe for World
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more