Struct rin::ecs::EntitiesDebug[][src]

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

EntitiesDebug is passed to DebugSystems when they are run and allows to access debug information for entities’ compoenents

Implementations

impl<'a> EntitiesDebug<'a>[src]

pub fn iter_for<'e, S>(&'e self) -> <S as UnorderedData<'e>>::Iter where
    S: UnorderedData<'e> + ReadOnlyOp<'e>, 
[src]

Iterator over all the components that match the operator

for (pos, vel) in entities.iter_for::<(Write<Position>, Read<Velocity>)>(){
    pos.x += vel.x;
    pos.y += vel.y;
}

Will iterate over all the entities that have both position and velocity and update the position by adding the velocity to it. In this example position can be modified cause we use the Write operator but velocity can only be read.

pub fn iter_for_mut<'e, S>(&'e mut self) -> <S as UnorderedData<'e>>::IterMut where
    S: UnorderedDataSend<'e>, 
[src]

Iterator over all the components that match the operator

Can be used with operators that access a storage mutably

for (pos, vel) in entities.iter_for_mut::<(Write<Position>, Read<Velocity>)>(){
    pos.x += vel.x;
    pos.y += vel.y;
}

Will iterate over all the entities that have both position and velocity and update the position by adding the velocity to it. In this example position can be modified cause we use the Write operator but velocity can only be read.

pub fn storage_for<'r, S>(&'r self) -> Sto<'r, S> where
    S: UnorderedDataSend<'r> + ReadOnlyOp<'r>, 
[src]

Storage for the operator passed as type parameter

Calling iter_for can be slow if it needs to be called lots of times. In those cases calling instead storage_for once and then iter() on it multiple times can make performance much better

let mut storage = entities.storage_for_mut::<(Write<Position>, Read<Velocity>)>().unwrap();
for i in 0..1000000 {
    for (pos, vel) in storage.iter_mut() {
        pos.x += vel.x;
        pos.y += vel.y;
    }
}

pub fn storage_for_mut<'r, S>(&'r mut self) -> Sto<'r, S> where
    S: UnorderedDataSend<'r>, 
[src]

pub fn ordered_iter_for<'e, S>(&'e self) -> <S as OrderedData<'e>>::Iter where
    S: OrderedDataSend<'e> + ReadOnlyOrderedOp<'e>, 
[src]

Iterator over ordered data

Similar to iter_for but to be used with operators that specify an order like ReadAndParent in which parents will be processed first and then their children

pub fn ordered_iter_for_mut<'e, S>(&'e mut self) -> <S as OrderedData<'e>>::Iter where
    S: OrderedDataSend<'e>, 
[src]

Iterator over ordered data

Similar to iter_for but to be used with operators that specify an order like ReadAndParent in which parents will be processed first and then their children

pub fn ordered_storage_for<'e, S>(
    &'e self
) -> Option<<S as OrderedData<'e>>::Storage> where
    S: OrderedDataSend<'e> + ReadOnlyOrderedOp<'e>, 
[src]

Storage for the operator passed as type parameter

Calling ordered_iter_for can be slow if it needs to be called lots of times. In those cases calling instead ordered_storage_for once and then iter() on it multiple times can make performance much better

pub fn ordered_storage_for_mut<'e, S>(
    &'e mut self
) -> Option<<S as OrderedData<'e>>::Storage> where
    S: OrderedDataSend<'e>, 
[src]

pub fn iter_for_entities<'e, U, E>(
    &'e self,
    entities: E
) -> <E as IntoEntitiesIterator<'e, <U as UnorderedData<'e>>::Storage>>::IntoEntitiesIter where
    E: IntoEntitiesIterator<'e, <U as UnorderedData<'e>>::Storage>,
    U: UnorderedData<'e>,
    <U as UnorderedData<'e>>::Storage: ReadOnlyStorage
[src]

Iterator for the specified operators over a set of entities instead of every entity in the world

It’s usage is similar to iter_for but instead of iterating over all the entities it only returns components that match the operators for the entities passed as parameter

let e1 = world.new_entity()
    .add(Position{x: 0., y: 0.})
    .build();
let e2 = world.new_entity()
    .add(Position{x: 0., y: 0.})
    .build();
let e3 = world.new_entity()
    .add(Position{x: 0., y: 0.})
    .build();
let entities = world.entities();
for pos in entities.iter_for_entities::<Read<Position>, _>(vec![e1, e2]){
    //...
}

The operators parameter in this method needs a second type for the entities iterator type which can jsut be elided with a _ since it’ll be guessed from the passed parameter

pub fn iter_for_entities_mut<'e, U, E>(
    &'e mut self,
    entities: E
) -> <E as IntoEntitiesIterator<'e, <U as UnorderedData<'e>>::Storage>>::IntoEntitiesIterMut where
    E: IntoEntitiesIterator<'e, <U as UnorderedData<'e>>::Storage>,
    U: UnorderedData<'e>, 
[src]

pub fn iter_for_entities_opt<'e, U, E>(
    &'e self,
    entities: E
) -> <E as IntoEntitiesIterator<'e, <U as UnorderedData<'e>>::Storage>>::IntoEntitiesOptIter where
    E: IntoEntitiesIterator<'e, <U as UnorderedData<'e>>::Storage>,
    U: UnorderedData<'e>,
    <U as UnorderedData<'e>>::Storage: ReadOnlyStorage
[src]

pub fn iter_for_entities_opt_mut<'e, U, E>(
    &'e mut self,
    entities: E
) -> <E as IntoEntitiesIterator<'e, <U as UnorderedData<'e>>::Storage>>::IntoEntitiesOptIterMut where
    E: IntoEntitiesIterator<'e, <U as UnorderedData<'e>>::Storage>,
    U: UnorderedData<'e>, 
[src]

pub fn entity_components<'r, S>(
    &'r self,
    entity: &Entity
) -> Option<<S as UnorderedData<'r>>::ComponentsRef> where
    S: UnorderedDataSend<'r> + ReadOnlyOp<'r> + 'r,
    <S as UnorderedData<'r>>::Storage: StorageRef<'r>,
    <<S as UnorderedData<'r>>::Storage as StorageRef<'r>>::Component == <S as UnorderedData<'r>>::ComponentsRef
[src]

Similar to iter_for_entities but for one entity instead of several

let e1 = world.new_entity()
    .add(Position{x: 0., y: 0.})
    .add(Velocity{x: 0., y: 0.})
    .build();
let entities = world.entities();
let (pos, vel) = entities
    .entity_components::<(Write<Position>, Read<Velocity>)>(&e1)
    .unwrap();

pub fn entity_components_mut<'r, S>(
    &'r mut self,
    entity: &Entity
) -> Option<<S as UnorderedData<'r>>::ComponentsRef> where
    S: UnorderedDataSend<'r> + 'r,
    <S as UnorderedData<'r>>::Storage: StorageRef<'r>,
    <<S as UnorderedData<'r>>::Storage as StorageRef<'r>>::Component == <S as UnorderedData<'r>>::ComponentsRef
[src]

pub fn component_for<C>(&self, entity: &Entity) -> Option<Ptr<'_, C>> where
    C: Component,
    <C as Component>::Storage: for<'s> Storage<'s, C>, 
[src]

Returns a component for reading for the passed entity

let e1 = world.new_entity()
    .add(Position{x: 0., y: 0.})
    .build();
let entities = world.entities();
let pos = entities.component_for::<Position>(&e1).unwrap();

pub fn component_for_mut<C>(&self, entity: &Entity) -> Option<PtrMut<'_, C>> where
    C: Component,
    <C as Component>::Storage: for<'s> Storage<'s, C>, 
[src]

Returns a component for writing for the passed entity

let e1 = world.new_entity()
    .add(Position{x: 0., y: 0.})
    .build();
let entities = world.entities();
let mut pos = entities.component_for_mut::<Position>(&e1).unwrap();

pub fn has_component<C>(&self, entity: &Entity) -> bool where
    C: 'static, 
[src]

Returns true if the entity has the specified component

let e1 = world.new_entity()
    .add(Position{x: 0., y: 0.})
    .build();
let entities = world.entities();
assert!(entities.has_component::<Position>(&e1));

pub fn tree_node_for<C>(&'r self, entity: &Entity) -> Option<NodePtr<'r, C>> where
    C: Component,
    <C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>, 
[src]

Returns the node for a hierarchical component

pub fn tree_node_for_mut<C>(
    &'r self,
    entity: &Entity
) -> Option<NodePtrMut<'r, C>> where
    C: Component,
    <C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>, 
[src]

Returns the node for a hierarchical component for writing

pub fn entity_component_ids(
    &self,
    entity: Entity
) -> impl Iterator<Item = &TypeId>
[src]

Returns an iterator over all the component Ids of the passed entity

Used to later ask for individual components to debug using debug_compoentn_for

pub fn debug_components_for<S>(
    &self,
    entity: Entity,
    serializer: S
) -> Result<(), Error> where
    S: Serializer
[src]

Debug all the components for an entity using the passed serializer

Only available when the debug_parameters feature is enabled.

Uses the passed serializer to debug the components of the entity.

By default when debug_parameters is enabled all components that implement Serialize will automatically implement DebugParameter used by this method to debug the components thorugh the serializer passed as parameter.

Components that don’t implement Serialize can still use the attribute #[debug_as_string] so they are debugged using their Debug String representation or #[debug_as_custom] and then explicitly implement DebugParameter which works as a custom serialization of the component more apt for debugging purposes

pub fn debug_component_for<S>(
    &self,
    entity: Entity,
    id: &TypeId,
    serializer: S
) -> Result<(), Error> where
    S: Serializer
[src]

Debug one specific compoenent of an entity.

Use entity_component_ids to retrieve all the Ids of the components of an entity or Component::id() ot get one specific component’s Id

See debug_components_for for more info about specifiying components debug format

pub fn split<D>(&mut self) -> (EntitiesDebug<'_>, EntitiesDebug<'_>) where
    D: DataAccesses
[src]

Trait Implementations

impl<'a> EntitiesExt<'a> for EntitiesDebug<'a>[src]

impl<'a> EntitiesStorage for EntitiesDebug<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for EntitiesDebug<'a>

impl<'a> !Send for EntitiesDebug<'a>

impl<'a> !Sync for EntitiesDebug<'a>

impl<'a> Unpin for EntitiesDebug<'a>

impl<'a> !UnwindSafe for EntitiesDebug<'a>

Blanket Implementations

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

impl<T> Any for T where
    T: Any
[src]

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

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

impl<T> Downcast for T where
    T: Any
[src]

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

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

impl<V> IntoPnt<V> for V[src]

impl<V> IntoVec<V> for V[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

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

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]