[−][src]Struct kudo::World
The world holds all components and associated entities.
Implementations
impl World
[src]
pub fn new() -> Self
[src]
Create the world.
pub fn spawn(&mut self, b: impl ComponentBundle) -> Entity
[src]
Spawn an entity with components passed in through a tuple. Multiple components can be passed in through the tuple.
Example
let mut world = World::new(); let entity = world.spawn((456, true));
pub fn despawn(&mut self, entity: Entity) -> Result<(), NoSuchEntity>
[src]
Remove an entity and all its components from the world. An error is returned if the entity does not exist.
pub fn get_component_mut<T: 'static>(
&mut self,
entity: Entity
) -> Result<&mut T, ComponentError>
[src]
&mut self,
entity: Entity
) -> Result<&mut T, ComponentError>
Gets mutable access to a single component on an Entity
.
pub fn remove_component<T: 'static>(
&mut self,
entity: Entity
) -> Result<T, ComponentError>
[src]
&mut self,
entity: Entity
) -> Result<T, ComponentError>
Remove a single component from an entity. If successful the component is returned.
Example
let mut world = World::new(); let entity = world.spawn((456, true)); let b = world.remove_component::<bool>(entity).unwrap();
pub fn add_component<T: 'static + Send + Sync>(
&mut self,
entity: Entity,
t: T
) -> Result<(), NoSuchEntity>
[src]
&mut self,
entity: Entity,
t: T
) -> Result<(), NoSuchEntity>
Adds a component to an entity. If the component already exists its data will be replaced.
pub fn query<'world_borrow, T: QueryParams>(
&'world_borrow self
) -> Result<Query<'_, T>, ComponentAlreadyBorrowed>
[src]
&'world_borrow self
) -> Result<Query<'_, T>, ComponentAlreadyBorrowed>
Auto Trait Implementations
impl !RefUnwindSafe for World
impl Send for World
impl Sync for World
impl Unpin for World
impl !UnwindSafe for World
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,