pub struct EntryRef<'a> { /* private fields */ }
Expand description
Provides safe read-only access to an entity’s components.
Implementations
sourceimpl<'a> EntryRef<'a>
impl<'a> EntryRef<'a>
sourcepub fn location(&self) -> EntityLocation
pub fn location(&self) -> EntityLocation
Returns the entity’s location.
sourcepub fn into_component<T: Component>(self) -> Result<&'a T, ComponentError>
pub fn into_component<T: Component>(self) -> Result<&'a T, ComponentError>
Returns a reference to one of the entity’s components.
sourcepub unsafe fn into_component_unchecked<T: Component>(
self
) -> Result<&'a mut T, ComponentError>
pub unsafe fn into_component_unchecked<T: Component>(
self
) -> Result<&'a mut T, ComponentError>
Returns a mutable reference to one of the entity’s components.
Safety
This function bypasses static borrow checking. The caller must ensure that the component reference will not be mutably aliased.
sourcepub fn get_component<T: Component>(&self) -> Result<&T, ComponentError>
pub fn get_component<T: Component>(&self) -> Result<&T, ComponentError>
Returns a reference to one of the entity’s components.
sourcepub unsafe fn get_component_unchecked<T: Component>(
&self
) -> Result<&mut T, ComponentError>
pub unsafe fn get_component_unchecked<T: Component>(
&self
) -> Result<&mut T, ComponentError>
Returns a mutable reference to one of the entity’s components.
Safety
This function bypasses static borrow checking. The caller must ensure that the component reference will not be mutably aliased.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for EntryRef<'a>
impl<'a> Send for EntryRef<'a>
impl<'a> Sync for EntryRef<'a>
impl<'a> Unpin for EntryRef<'a>
impl<'a> !UnwindSafe for EntryRef<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcepub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcepub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcepub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcepub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more