pub struct ObjectRef<'w, 's, 'a, T: Kind = Any>(/* private fields */);
Implementations§
Source§impl<'w, 's, 'a, T: Kind> ObjectRef<'w, 's, 'a, T>
impl<'w, 's, 'a, T: Kind> ObjectRef<'w, 's, 'a, T>
Sourcepub unsafe fn from_base_unchecked(base: ObjectRef<'w, 's, 'a>) -> Self
pub unsafe fn from_base_unchecked(base: ObjectRef<'w, 's, 'a>) -> Self
Creates a new ObjectRef<T>
from an ObjectRef<Any>
.
This is semantically equivalent to an unsafe downcast.
§Safety
Assumes base
is of Kind
T
.
Sourcepub fn contains<U: Component>(&self) -> bool
pub fn contains<U: Component>(&self) -> bool
See EntityRef::contains
.
Trait Implementations§
Source§impl<T: Kind> ContainsInstance<T> for ObjectRef<'_, '_, '_, T>
impl<T: Kind> ContainsInstance<T> for ObjectRef<'_, '_, '_, T>
Source§impl<T: Kind> ObjectHierarchy<T> for ObjectRef<'_, '_, '_, T>
impl<T: Kind> ObjectHierarchy<T> for ObjectRef<'_, '_, '_, T>
Source§fn parent(&self) -> Option<Self::Rebind<Any>>
fn parent(&self) -> Option<Self::Rebind<Any>>
Returns the parent of this object, if it exists.
Source§fn children(&self) -> impl Iterator<Item = Self::Rebind<Any>>
fn children(&self) -> impl Iterator<Item = Self::Rebind<Any>>
Returns an iterator over all the children of this object.
Source§fn ancestors(&self) -> impl Iterator<Item = Self::Rebind<Any>>
fn ancestors(&self) -> impl Iterator<Item = Self::Rebind<Any>>
Returns an iterator over all ancestors of this object.
Source§fn descendants_wide(&self) -> impl Iterator<Item = Self::Rebind<Any>>
fn descendants_wide(&self) -> impl Iterator<Item = Self::Rebind<Any>>
Returns an iterator over all descendants of this object in breadth-first order.
Source§fn descendants_deep(&self) -> impl Iterator<Item = Self::Rebind<Any>>
fn descendants_deep(&self) -> impl Iterator<Item = Self::Rebind<Any>>
Returns an iterator over all descendants of this object in depth-first order.
Source§fn find_by_path(&self, path: impl AsRef<str>) -> Option<Self::Rebind<Any>>
fn find_by_path(&self, path: impl AsRef<str>) -> Option<Self::Rebind<Any>>
Attempts to find an object by its path, relative to this one. Read more
Source§fn is_child_of(&self, parent: Entity) -> bool
fn is_child_of(&self, parent: Entity) -> bool
Returns true if this object is a child of the given parent entity.
Source§fn has_children(&self) -> bool
fn has_children(&self) -> bool
Returns true if this object has any children.
Source§fn query_children<'a, Q: QueryData, F: QueryFilter>(
&'a self,
query: &'a Query<'_, '_, Q, F>,
) -> impl Iterator<Item = QueryItem<'a, Q::ReadOnly>> + 'a
fn query_children<'a, Q: QueryData, F: QueryFilter>( &'a self, query: &'a Query<'_, '_, Q, F>, ) -> impl Iterator<Item = QueryItem<'a, Q::ReadOnly>> + 'a
Queries the children of this object.
Source§fn children_of_kind<'a, U: Kind>(
&'a self,
objects: &'a Objects<'_, '_, U>,
) -> impl Iterator<Item = Self::Rebind<U>> + 'a
fn children_of_kind<'a, U: Kind>( &'a self, objects: &'a Objects<'_, '_, U>, ) -> impl Iterator<Item = Self::Rebind<U>> + 'a
Returns an iterator over all children of this object which are of the given kind.
Source§fn find_child_of_kind<U: Kind>(
&self,
objects: &Objects<'_, '_, U>,
) -> Option<Self::Rebind<U>>
fn find_child_of_kind<U: Kind>( &self, objects: &Objects<'_, '_, U>, ) -> Option<Self::Rebind<U>>
Returns the first child of this object which is of the given kind, if it exists.
Source§fn self_and_ancestors(&self) -> impl Iterator<Item = Self::Rebind<Any>>
fn self_and_ancestors(&self) -> impl Iterator<Item = Self::Rebind<Any>>
Returns an iterator over this object and all its ancestors.
Source§fn is_ancestor_of(&self, entity: Entity) -> bool
fn is_ancestor_of(&self, entity: Entity) -> bool
Returns true if this object is an ancestor of the given entity.
Source§fn query_ancestors<'a, Q: QueryData, F: QueryFilter>(
&'a self,
query: &'a Query<'_, '_, Q, F>,
) -> impl Iterator<Item = QueryItem<'a, Q::ReadOnly>> + 'a
fn query_ancestors<'a, Q: QueryData, F: QueryFilter>( &'a self, query: &'a Query<'_, '_, Q, F>, ) -> impl Iterator<Item = QueryItem<'a, Q::ReadOnly>> + 'a
Queries the ancestors of this object.
Source§fn query_self_and_ancestors<'a, Q: QueryData, F: QueryFilter>(
&'a self,
query: &'a Query<'_, '_, Q, F>,
) -> impl Iterator<Item = QueryItem<'a, Q::ReadOnly>> + 'a
fn query_self_and_ancestors<'a, Q: QueryData, F: QueryFilter>( &'a self, query: &'a Query<'_, '_, Q, F>, ) -> impl Iterator<Item = QueryItem<'a, Q::ReadOnly>> + 'a
Queries this object and its ancestors.
Source§fn ancestors_of_kind<'a, U: Kind>(
&'a self,
objects: &'a Objects<'_, '_, U>,
) -> impl Iterator<Item = Self::Rebind<U>> + 'a
fn ancestors_of_kind<'a, U: Kind>( &'a self, objects: &'a Objects<'_, '_, U>, ) -> impl Iterator<Item = Self::Rebind<U>> + 'a
Returns an iterator over all ancestors of this object which are of the given kind.
Source§fn self_and_ancestors_of_kind<'a, U: Kind>(
&'a self,
objects: &'a Objects<'_, '_, U>,
) -> impl Iterator<Item = Self::Rebind<U>> + 'a
fn self_and_ancestors_of_kind<'a, U: Kind>( &'a self, objects: &'a Objects<'_, '_, U>, ) -> impl Iterator<Item = Self::Rebind<U>> + 'a
Returns an iterator over this object and all its ancestors which are of the given kind.
Source§fn find_ancestor_of_kind<U: Kind>(
&self,
objects: &Objects<'_, '_, U>,
) -> Option<Self::Rebind<U>>
fn find_ancestor_of_kind<U: Kind>( &self, objects: &Objects<'_, '_, U>, ) -> Option<Self::Rebind<U>>
Returns the first ancestor of this object which is of the given kind, if it exists.
Source§fn self_and_descendants_wide(&self) -> impl Iterator<Item = Self::Rebind<Any>>
fn self_and_descendants_wide(&self) -> impl Iterator<Item = Self::Rebind<Any>>
Returns an iterator over this object and all its descendants in breadth-first order.
Source§fn self_and_descendants_deep(&self) -> impl Iterator<Item = Self::Rebind<Any>>
fn self_and_descendants_deep(&self) -> impl Iterator<Item = Self::Rebind<Any>>
Returns an iterator over this object and all its descendants in depth-first order.
Source§fn is_descendant_of(&self, entity: Entity) -> bool
fn is_descendant_of(&self, entity: Entity) -> bool
Returns true if this object is a descendant of the given entity.
Source§fn descendants_of_kind_wide<'a, U: Kind>(
&'a self,
objects: &'a Objects<'_, '_, U>,
) -> impl Iterator<Item = Self::Rebind<U>> + 'a
fn descendants_of_kind_wide<'a, U: Kind>( &'a self, objects: &'a Objects<'_, '_, U>, ) -> impl Iterator<Item = Self::Rebind<U>> + 'a
Queries the descendants of this object in breadth-first order.
Source§fn descendants_of_kind_deep<'a, U: Kind>(
&'a self,
objects: &'a Objects<'_, '_, U>,
) -> impl Iterator<Item = Self::Rebind<U>> + 'a
fn descendants_of_kind_deep<'a, U: Kind>( &'a self, objects: &'a Objects<'_, '_, U>, ) -> impl Iterator<Item = Self::Rebind<U>> + 'a
Queries the descendants of this object in depth-first order.
Source§fn self_and_descendants_of_kind_wide<'a, U: Kind>(
&'a self,
objects: &'a Objects<'_, '_, U>,
) -> impl Iterator<Item = Self::Rebind<U>> + 'a
fn self_and_descendants_of_kind_wide<'a, U: Kind>( &'a self, objects: &'a Objects<'_, '_, U>, ) -> impl Iterator<Item = Self::Rebind<U>> + 'a
Queries this object and all its descendants in breadth-first order.
Source§fn self_and_descendants_of_kind_deep<'a, U: Kind>(
&'a self,
objects: &'a Objects<'_, '_, U>,
) -> impl Iterator<Item = Self::Rebind<U>> + 'a
fn self_and_descendants_of_kind_deep<'a, U: Kind>( &'a self, objects: &'a Objects<'_, '_, U>, ) -> impl Iterator<Item = Self::Rebind<U>> + 'a
Queries this object and all its descendants in depth-first order.
Source§fn query_descendants_wide<'a, 'q, Q: QueryData, F: QueryFilter>(
&'a self,
query: &'q Query<'_, '_, Q, F>,
) -> impl Iterator<Item = QueryItem<'q, Q::ReadOnly>> + 'awhere
'q: 'a,
fn query_descendants_wide<'a, 'q, Q: QueryData, F: QueryFilter>(
&'a self,
query: &'q Query<'_, '_, Q, F>,
) -> impl Iterator<Item = QueryItem<'q, Q::ReadOnly>> + 'awhere
'q: 'a,
Queries the descendants of this object in breadth-first order.
Source§fn query_descendants_deep<'a, 'q, Q: QueryData, F: QueryFilter>(
&'a self,
query: &'q Query<'_, '_, Q, F>,
) -> impl Iterator<Item = QueryItem<'q, Q::ReadOnly>> + 'awhere
'q: 'a,
fn query_descendants_deep<'a, 'q, Q: QueryData, F: QueryFilter>(
&'a self,
query: &'q Query<'_, '_, Q, F>,
) -> impl Iterator<Item = QueryItem<'q, Q::ReadOnly>> + 'awhere
'q: 'a,
Queries the descendants of this object in depth-first order.
Source§fn query_self_and_descendants_wide<'a, 'q, Q: QueryData, F: QueryFilter>(
&'a self,
query: &'q Query<'_, '_, Q, F>,
) -> impl Iterator<Item = QueryItem<'q, Q::ReadOnly>> + 'awhere
'q: 'a,
fn query_self_and_descendants_wide<'a, 'q, Q: QueryData, F: QueryFilter>(
&'a self,
query: &'q Query<'_, '_, Q, F>,
) -> impl Iterator<Item = QueryItem<'q, Q::ReadOnly>> + 'awhere
'q: 'a,
Queries this object and all its descendants in breadth-first order.
Source§fn query_self_and_descendants_deep<'a, 'q, Q: QueryData>(
&'a self,
query: &'q Query<'_, '_, Q>,
) -> impl Iterator<Item = QueryItem<'q, Q::ReadOnly>> + 'awhere
'q: 'a,
fn query_self_and_descendants_deep<'a, 'q, Q: QueryData>(
&'a self,
query: &'q Query<'_, '_, Q>,
) -> impl Iterator<Item = QueryItem<'q, Q::ReadOnly>> + 'awhere
'q: 'a,
Queries this object and all its descendants in depth-first order.
Source§fn find_descendant_of_kind_wide<U: Kind>(
&self,
objects: &Objects<'_, '_, U>,
) -> Option<Self::Rebind<U>>
fn find_descendant_of_kind_wide<U: Kind>( &self, objects: &Objects<'_, '_, U>, ) -> Option<Self::Rebind<U>>
Returns the first descendant of this object (breadth-first order) which is of the given kind, if it exists.
Source§impl<T: Kind> ObjectName for ObjectRef<'_, '_, '_, T>
impl<T: Kind> ObjectName for ObjectRef<'_, '_, '_, T>
Source§impl<'w, 's, 'a, T: Kind> ObjectRebind<T> for ObjectRef<'w, 's, 'a, T>
impl<'w, 's, 'a, T: Kind> ObjectRebind<T> for ObjectRef<'w, 's, 'a, T>
Source§fn cast_into_any(self) -> Self::Rebind<Any>
fn cast_into_any(self) -> Self::Rebind<Any>
Casts this object into an
Object<Any>
. Read moreimpl<T: Kind> Copy for ObjectRef<'_, '_, '_, T>
impl<T: Kind> Eq for ObjectRef<'_, '_, '_, T>
Auto Trait Implementations§
impl<'w, 's, 'a, T> Freeze for ObjectRef<'w, 's, 'a, T>
impl<'w, 's, 'a, T = Any> !RefUnwindSafe for ObjectRef<'w, 's, 'a, T>
impl<'w, 's, 'a, T> Send for ObjectRef<'w, 's, 'a, T>
impl<'w, 's, 'a, T> Sync for ObjectRef<'w, 's, 'a, T>
impl<'w, 's, 'a, T> Unpin for ObjectRef<'w, 's, 'a, T>where
T: Unpin,
impl<'w, 's, 'a, T = Any> !UnwindSafe for ObjectRef<'w, 's, 'a, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.