[−][src]Struct goggles::world::ComponentAccess
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]
C: Component,
R: Deref<Target = ComponentStorage<C>>,
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]
C: Component,
R: DerefMut<Target = ComponentStorage<C>>,
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]
&mut self,
e: Entity,
f: impl FnOnce() -> C
) -> Result<&mut C, WrongGeneration>
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]
C: PartialEq,
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]
C: Component,
C::Storage: DenseStorage,
R: Deref<Target = ComponentStorage<C>>,
impl<'a, C, R> ComponentAccess<'a, C, R> where
C: Component,
C::Storage: TrackedStorage,
R: Deref<Target = ComponentStorage<C>>,
[src]
C: Component,
C::Storage: TrackedStorage,
R: Deref<Target = ComponentStorage<C>>,
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]
C: Component,
C::Storage: DenseStorage,
R: DerefMut<Target = ComponentStorage<C>>,
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]
C: Component,
C::Storage: TrackedStorage,
R: DerefMut<Target = ComponentStorage<C>>,
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]
C: Component,
R: Deref<Target = ComponentStorage<C>> + 'a,
impl<'a, 'b, C, R> IntoJoin for &'a mut ComponentAccess<'b, C, R> where
C: Component,
R: DerefMut<Target = ComponentStorage<C>> + 'a,
[src]
C: Component,
R: DerefMut<Target = ComponentStorage<C>> + 'a,
Auto Trait Implementations
impl<'a, C, R> RefUnwindSafe for ComponentAccess<'a, C, R> where
C: RefUnwindSafe,
R: RefUnwindSafe,
C: RefUnwindSafe,
R: RefUnwindSafe,
impl<'a, C, R> Send for ComponentAccess<'a, C, R> where
C: Send,
R: Send,
C: Send,
R: Send,
impl<'a, C, R> Sync for ComponentAccess<'a, C, R> where
C: Sync,
R: Sync,
C: Sync,
R: Sync,
impl<'a, C, R> Unpin for ComponentAccess<'a, C, R> where
C: Unpin,
R: Unpin,
C: Unpin,
R: Unpin,
impl<'a, C, R> UnwindSafe for ComponentAccess<'a, C, R> where
C: UnwindSafe,
R: UnwindSafe,
C: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
[src]
T: Any,
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> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
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>,