Struct shipyard::EntitiesView[][src]

pub struct EntitiesView<'a> { /* fields omitted */ }

Shared view over Entities storage.

Methods from Deref<Target = Entities>

pub fn is_alive(&self, entity: EntityId) -> bool[src]

Returns true if entity matches a living entity.

pub fn add_component<S: AddComponent>(
    &self,
    entity: EntityId,
    storages: S,
    component: S::Component
)
[src]

Adds component to entity, multiple components can be added at the same time using a tuple.
Entities is only borrowed immutably.

Panics

  • entity is not alive.

Example

use shipyard::{EntitiesView, ViewMut, World};

let mut world = World::new();

let entity = world.add_entity(());

let (entities, mut u32s) = world.borrow::<(EntitiesView, ViewMut<u32>)>().unwrap();

entities.add_component(entity, &mut u32s, 0);

pub fn iter(&self) -> EntitiesIter<'_>[src]

Creates an iterator over all entities.

Trait Implementations

impl<'a> BorrowInfo for EntitiesView<'a>[src]

impl Clone for EntitiesView<'_>[src]

impl Deref for EntitiesView<'_>[src]

type Target = Entities

The resulting type after dereferencing.

impl IntoBorrow for EntitiesView<'_>[src]

type Borrow = EntitiesBorrower

Helper type almost allowing GAT on stable.

Auto Trait Implementations

impl<'a> RefUnwindSafe for EntitiesView<'a>

impl<'a> Send for EntitiesView<'a>

impl<'a> Sync for EntitiesView<'a>

impl<'a> Unpin for EntitiesView<'a>

impl<'a> UnwindSafe for EntitiesView<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.