Struct Object

Source
pub struct Object<'w, 's, 'a, T: Kind = Any> { /* private fields */ }
Expand description

Represents an Entity of Kind T with hierarchy and name information.

Implementations§

Source§

impl<'w, 's, 'a, T: Kind> Object<'w, 's, 'a, T>

Source

pub unsafe fn from_base_unchecked(base: Object<'w, 's, 'a>) -> Self

Creates a new Object<T> from an Object<Any>.

This is semantically equivalent to an unsafe downcast.

§Safety

Assumes base is of Kind T.

Source§

impl<'w, 's, 'a, T: Component> Object<'w, 's, 'a, T>

Source

pub fn from_base( world: &World, object: Object<'w, 's, 'a>, ) -> Option<Object<'w, 's, 'a, T>>

Trait Implementations§

Source§

impl<T: Kind> Clone for Object<'_, '_, '_, T>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Kind> Debug for Object<'_, '_, '_, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'w, 's, 'a, T: Kind> From<&ObjectRef<'w, 's, 'a, T>> for Object<'w, 's, 'a, T>

Source§

fn from(object: &ObjectRef<'w, 's, 'a, T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Kind> From<Object<'_, '_, '_, T>> for Entity

Source§

fn from(object: Object<'_, '_, '_, T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Kind> From<Object<'_, '_, '_, T>> for Instance<T>

Source§

fn from(object: Object<'_, '_, '_, T>) -> Self

Converts to this type from the input type.
Source§

impl<'w, 's, 'a, T: Kind> From<ObjectRef<'w, 's, 'a, T>> for Object<'w, 's, 'a, T>

Source§

fn from(object: ObjectRef<'w, 's, 'a, T>) -> Self

Converts to this type from the input type.
Source§

impl<'w, 's, 'a, T: Kind> ObjectHierarchy<T> for Object<'w, 's, 'a, T>

Source§

fn parent(&self) -> Option<Self::Rebind<Any>>

Source§

fn children(&self) -> impl Iterator<Item = Self::Rebind<Any>>

Source§

fn ancestors(&self) -> impl Iterator<Item = Self::Rebind<Any>>

Source§

fn descendants_wide(&self) -> impl Iterator<Item = Self::Rebind<Any>>

Source§

fn descendants_deep(&self) -> impl Iterator<Item = Self::Rebind<Any>>

Source§

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 root(&self) -> Self::Rebind<Any>

Source§

fn is_root(&self) -> bool

Source§

fn is_child(&self) -> bool

Source§

fn is_child_of(&self, parent: Entity) -> bool

Source§

fn has_children(&self) -> bool

Source§

fn query_children<'a, Q: QueryData, F: QueryFilter>( &'a self, query: &'a Query<'_, '_, Q, F>, ) -> impl Iterator<Item = QueryItem<'a, Q::ReadOnly>> + 'a

Source§

fn children_of_kind<'a, U: Kind>( &'a self, objects: &'a Objects<'_, '_, U>, ) -> impl Iterator<Item = Self::Rebind<U>> + 'a

Source§

fn find_child_of_kind<U: Kind>( &self, objects: &Objects<'_, '_, U>, ) -> Option<Self::Rebind<U>>

Source§

fn self_and_ancestors(&self) -> impl Iterator<Item = Self::Rebind<Any>>

Source§

fn is_ancestor_of(&self, entity: Entity) -> bool
where Self::Rebind<Any>: ObjectHierarchy<Any>,

Source§

fn query_ancestors<'a, Q: QueryData, F: QueryFilter>( &'a self, query: &'a Query<'_, '_, Q, F>, ) -> impl Iterator<Item = QueryItem<'a, Q::ReadOnly>> + 'a

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

Source§

fn ancestors_of_kind<'a, U: Kind>( &'a self, objects: &'a Objects<'_, '_, U>, ) -> impl Iterator<Item = Self::Rebind<U>> + 'a

Source§

fn find_ancestor_of_kind<U: Kind>( &self, objects: &Objects<'_, '_, U>, ) -> Option<Self::Rebind<U>>

Source§

fn self_and_descendants_wide(&self) -> impl Iterator<Item = Self::Rebind<Any>>

Source§

fn self_and_descendants_deep(&self) -> impl Iterator<Item = Self::Rebind<Any>>

Source§

fn is_descendant_of(&self, entity: Entity) -> bool
where Self::Rebind<Any>: ObjectHierarchy<Any>,

Source§

fn descendants_of_kind_wide<'a, U: Kind>( &'a self, objects: &'a Objects<'_, '_, U>, ) -> impl Iterator<Item = Self::Rebind<U>> + 'a

Source§

fn descendants_of_kind_deep<'a, U: Kind>( &'a self, objects: &'a Objects<'_, '_, U>, ) -> impl Iterator<Item = Self::Rebind<U>> + 'a

Source§

fn query_descendants_wide<'a, Q: QueryData>( &'a self, query: &'a Query<'_, '_, Q>, ) -> impl Iterator<Item = QueryItem<'a, Q::ReadOnly>> + 'a

Source§

fn query_descendants_deep<'a, Q: QueryData>( &'a self, query: &'a Query<'_, '_, Q>, ) -> impl Iterator<Item = QueryItem<'a, Q::ReadOnly>> + 'a

Source§

fn query_self_and_descendants_wide<'a, Q: QueryData>( &'a self, query: &'a Query<'_, '_, Q>, ) -> impl Iterator<Item = QueryItem<'a, Q::ReadOnly>> + 'a

Source§

fn query_self_and_descendants_deep<'a, Q: QueryData>( &'a self, query: &'a Query<'_, '_, Q>, ) -> impl Iterator<Item = QueryItem<'a, Q::ReadOnly>> + 'a

Source§

fn find_descendant_of_kind_wide<U: Kind>( &self, objects: &Objects<'_, '_, U>, ) -> Option<Self::Rebind<U>>

Source§

fn find_descendant_of_kind_deep<U: Kind>( &self, objects: &Objects<'_, '_, U>, ) -> Option<Self::Rebind<U>>

Source§

impl<T: Kind> ObjectInstance<T> for Object<'_, '_, '_, T>

Source§

fn instance(&self) -> Instance<T>

Returns the Instance of this object. Read more
Source§

fn entity(&self) -> Entity

Returns the Entity of this object.
Source§

impl<T: Kind> ObjectName for Object<'_, '_, '_, T>

Source§

fn name(&self) -> Option<&str>

Returns the Name of this object. Read more
Source§

impl<'w, 's, 'a, T: Kind> ObjectRebind<T> for Object<'w, 's, 'a, T>

Source§

type Rebind<U: Kind> = Object<'w, 's, 'a, U>

Source§

fn rebind_as<U: Kind>(&self, instance: Instance<U>) -> Self::Rebind<U>

Rebinds this object to an Instance of another Kind. Read more
Source§

fn rebind(&self, instance: Instance<T>) -> Self::Rebind<T>

Rebinds this object to another Instance of the same Kind. Read more
Source§

fn rebind_any(&self, entity: Entity) -> Self::Rebind<Any>

Rebinds this object to another Entity. Read more
Source§

fn cast_into<U: Kind>(self) -> Self::Rebind<U>
where T: CastInto<U>,

Casts this object into another of a related Kind. Read more
Source§

fn cast_into_any(self) -> Self::Rebind<Any>

Casts this object into an Object<Any>. Read more
Source§

unsafe fn cast_into_unchecked<U: Kind>(self) -> Self::Rebind<U>

Casts this object into another of a different Kind. Read more
Source§

impl<T: Kind> PartialEq for Object<'_, '_, '_, T>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Kind> Copy for Object<'_, '_, '_, T>

Source§

impl<T: Kind> Eq for Object<'_, '_, '_, T>

Auto Trait Implementations§

§

impl<'w, 's, 'a, T> Freeze for Object<'w, 's, 'a, T>

§

impl<'w, 's, 'a, T = Any> !RefUnwindSafe for Object<'w, 's, 'a, T>

§

impl<'w, 's, 'a, T> Send for Object<'w, 's, 'a, T>

§

impl<'w, 's, 'a, T> Sync for Object<'w, 's, 'a, T>

§

impl<'w, 's, 'a, T> Unpin for Object<'w, 's, 'a, T>
where T: Unpin,

§

impl<'w, 's, 'a, T = Any> !UnwindSafe for Object<'w, 's, 'a, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

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.
Source§

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.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynEq for T
where T: Any + Eq,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Casts the type to dyn Any.
Source§

fn dyn_eq(&self, other: &(dyn DynEq + 'static)) -> bool

This method tests for self and other values to be equal. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TypeData for T
where T: 'static + Send + Sync + Clone,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ConditionalSend for T
where T: Send,