Struct oxygengine_core::ecs::ChangeSet [−][src]
pub struct ChangeSet<T> { /* fields omitted */ }
Change set that can be collected from an iterator, and joined on for easy application to components.
Example
pub struct Health(i32); impl Component for Health { type Storage = DenseVecStorage<Self>; } let a = world.create_entity().with(Health(100)).build(); let b = world.create_entity().with(Health(200)).build(); let changeset = [(a, 32), (b, 12), (b, 13)] .iter() .cloned() .collect::<ChangeSet<i32>>(); for (health, modifier) in (&mut world.write_storage::<Health>(), &changeset).join() { health.0 -= modifier; }
Implementations
impl<T> ChangeSet<T>
[src]
impl<T> ChangeSet<T>
[src]pub fn new() -> ChangeSet<T>
[src]
Create a new change set
pub fn add(&mut self, entity: Entity, value: T) where
T: AddAssign<T>,
[src]
T: AddAssign<T>,
Add a value to the change set. If the entity already have a value in the change set, the incoming value will be added to that.
pub fn clear(&mut self)
[src]
Clear the changeset
Trait Implementations
impl<T> Extend<(Entity, T)> for ChangeSet<T> where
T: AddAssign<T>,
[src]
impl<T> Extend<(Entity, T)> for ChangeSet<T> where
T: AddAssign<T>,
[src]pub fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = (Entity, T)>,
[src]
I: IntoIterator<Item = (Entity, T)>,
pub fn extend_one(&mut self, item: A)
[src]
pub fn extend_reserve(&mut self, additional: usize)
[src]
impl<T> Join for ChangeSet<T>
[src]
impl<T> Join for ChangeSet<T>
[src]A Join
implementation for ChangeSet
that simply removes all the entries
on a call to get
.
type Mask = BitSet
Type of joined bit mask.
type Type = T
Type of joined components.
type Value = DenseVecStorage<T>
Type of joined storages.
pub unsafe fn open(
self
) -> (<ChangeSet<T> as Join>::Mask, <ChangeSet<T> as Join>::Value)
[src]
self
) -> (<ChangeSet<T> as Join>::Mask, <ChangeSet<T> as Join>::Value)
pub unsafe fn get(
value: &mut <ChangeSet<T> as Join>::Value,
id: u32
) -> <ChangeSet<T> as Join>::Type
[src]
value: &mut <ChangeSet<T> as Join>::Value,
id: u32
) -> <ChangeSet<T> as Join>::Type
pub fn join(self) -> JoinIter<Self>ⓘ
[src]
pub fn maybe(self) -> MaybeJoin<Self>
[src]
pub fn is_unconstrained() -> bool
[src]
impl<'a, T> Join for &'a ChangeSet<T>
[src]
impl<'a, T> Join for &'a ChangeSet<T>
[src]type Mask = &'a BitSet
Type of joined bit mask.
type Type = &'a T
Type of joined components.
type Value = &'a DenseVecStorage<T>
Type of joined storages.
pub unsafe fn open(
self
) -> (<&'a ChangeSet<T> as Join>::Mask, <&'a ChangeSet<T> as Join>::Value)
[src]
self
) -> (<&'a ChangeSet<T> as Join>::Mask, <&'a ChangeSet<T> as Join>::Value)
pub unsafe fn get(
value: &mut <&'a ChangeSet<T> as Join>::Value,
id: u32
) -> <&'a ChangeSet<T> as Join>::Type
[src]
value: &mut <&'a ChangeSet<T> as Join>::Value,
id: u32
) -> <&'a ChangeSet<T> as Join>::Type
pub fn join(self) -> JoinIter<Self>ⓘ
[src]
pub fn maybe(self) -> MaybeJoin<Self>
[src]
pub fn is_unconstrained() -> bool
[src]
impl<'a, T> Join for &'a mut ChangeSet<T>
[src]
impl<'a, T> Join for &'a mut ChangeSet<T>
[src]type Mask = &'a BitSet
Type of joined bit mask.
type Type = &'a mut T
Type of joined components.
type Value = &'a mut DenseVecStorage<T>
Type of joined storages.
pub unsafe fn open(
self
) -> (<&'a mut ChangeSet<T> as Join>::Mask, <&'a mut ChangeSet<T> as Join>::Value)
[src]
self
) -> (<&'a mut ChangeSet<T> as Join>::Mask, <&'a mut ChangeSet<T> as Join>::Value)
pub unsafe fn get(
v: &mut <&'a mut ChangeSet<T> as Join>::Value,
id: u32
) -> <&'a mut ChangeSet<T> as Join>::Type
[src]
v: &mut <&'a mut ChangeSet<T> as Join>::Value,
id: u32
) -> <&'a mut ChangeSet<T> as Join>::Type
pub fn join(self) -> JoinIter<Self>ⓘ
[src]
pub fn maybe(self) -> MaybeJoin<Self>
[src]
pub fn is_unconstrained() -> bool
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for ChangeSet<T> where
T: RefUnwindSafe,
impl<T> RefUnwindSafe for ChangeSet<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for ChangeSet<T> where
T: UnwindSafe,
impl<T> UnwindSafe for ChangeSet<T> where
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: Any,
impl<T> Any for T where
T: Any,
pub fn get_type_id(&self) -> TypeId
impl<T> TryDefault for T where
T: Default,
[src]
impl<T> TryDefault for T where
T: Default,
[src]