[][src]Struct goggles::world::ComponentAccess

pub struct ComponentAccess<'a, C, R> where
    C: Component
{ /* fields omitted */ }

Returned from the World methods read_component, write_component, and get_component_mut.

This is a simple wrapper around a MaskedStorage paired with an entity Allocator. It prevents you from inserting or accessing components that do not have a live Entity associated with them.

Implementations

impl<'a, C, R> ComponentAccess<'a, C, R> where
    C: Component,
    R: Deref<Target = ComponentStorage<C>>, 
[src]

pub fn entities(&self) -> &Entities<'_>[src]

pub fn storage(&self) -> &ComponentStorage<C>[src]

pub fn contains(&self, e: Entity) -> bool[src]

pub fn get(&self, e: Entity) -> Option<&C>[src]

impl<'a, C, R> ComponentAccess<'a, C, R> where
    C: Component,
    R: DerefMut<Target = ComponentStorage<C>>, 
[src]

pub fn storage_mut(&mut self) -> &mut ComponentStorage<C>[src]

Access the inner MaskedStorage type.

It is possible by using this type directly to insert components into the underlying MaskedStorage for indexes that do not have a live Entity associated with them. This is not unsafe to do, but it is probably incorrect, and such components may either never be automatically removed or possibly be assigned to new entities that have the same index.

pub fn get_mut(&mut self, e: Entity) -> Option<&mut C>[src]

pub fn get_or_insert_with(
    &mut self,
    e: Entity,
    f: impl FnOnce() -> C
) -> Result<&mut C, WrongGeneration>
[src]

pub fn insert(&mut self, e: Entity, c: C) -> Result<Option<C>, WrongGeneration>[src]

pub fn update(&mut self, e: Entity, c: C) -> Result<Option<C>, WrongGeneration> where
    C: PartialEq
[src]

pub fn remove(&mut self, e: Entity) -> Result<Option<C>, WrongGeneration>[src]

pub fn guard(&mut self) -> GuardedJoin<'_, C::Storage>[src]

impl<'a, C, R> ComponentAccess<'a, C, R> where
    C: Component,
    C::Storage: DenseStorage,
    R: Deref<Target = ComponentStorage<C>>, 
[src]

pub fn as_slice(&self) -> &[C][src]

impl<'a, C, R> ComponentAccess<'a, C, R> where
    C: Component,
    C::Storage: TrackedStorage,
    R: Deref<Target = ComponentStorage<C>>, 
[src]

pub fn tracking_modified(&self) -> bool[src]

pub fn modified_indexes(&self) -> &ModifiedBitSet[src]

pub fn mark_modified(&self, entity: Entity) -> Result<(), WrongGeneration>[src]

pub fn modified(&self) -> ModifiedJoin<'_, C::Storage>[src]

impl<'a, C, R> ComponentAccess<'a, C, R> where
    C: Component,
    C::Storage: DenseStorage,
    R: DerefMut<Target = ComponentStorage<C>>, 
[src]

pub fn as_mut_slice(&mut self) -> &mut [C][src]

impl<'a, C, R> ComponentAccess<'a, C, R> where
    C: Component,
    C::Storage: TrackedStorage,
    R: DerefMut<Target = ComponentStorage<C>>, 
[src]

pub fn set_track_modified(&mut self, flag: bool)[src]

pub fn clear_modified(&mut self)[src]

pub fn modified_mut(&mut self) -> ModifiedJoinMut<'_, C::Storage>[src]

Trait Implementations

impl<'a, 'b, C, R> IntoJoin for &'a ComponentAccess<'b, C, R> where
    C: Component,
    R: Deref<Target = ComponentStorage<C>> + 'a, 
[src]

type Item = &'a C

type IntoJoin = &'a ComponentStorage<C>

impl<'a, 'b, C, R> IntoJoin for &'a mut ComponentAccess<'b, C, R> where
    C: Component,
    R: DerefMut<Target = ComponentStorage<C>> + 'a, 
[src]

type Item = &'a mut C

type IntoJoin = &'a mut ComponentStorage<C>

Auto Trait Implementations

impl<'a, C, R> RefUnwindSafe for ComponentAccess<'a, C, R> where
    C: RefUnwindSafe,
    R: RefUnwindSafe

impl<'a, C, R> Send for ComponentAccess<'a, C, R> where
    C: Send,
    R: Send

impl<'a, C, R> Sync for ComponentAccess<'a, C, R> where
    C: Sync,
    R: Sync

impl<'a, C, R> Unpin for ComponentAccess<'a, C, R> where
    C: Unpin,
    R: Unpin

impl<'a, C, R> UnwindSafe for ComponentAccess<'a, C, R> where
    C: UnwindSafe,
    R: UnwindSafe

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> 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, 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.