Struct Instance

Source
pub struct Instance<T: Kind>(/* private fields */);
Expand description

Represents an Entity of Kind T.

Instance<Any> is functionally equivalent to an entity.

§Usage

An Instance<T> can be used to access entities in a “kind-safe” manner to improve safety and readability.

This type is designed to behave exactly like an Entity.

This means you may use it as a Query parameter, pass it to Commands to access InstanceCommands<T>, or store it as a type-safe reference to an Entity.

Note that an Instance<T> has 'static lifetime and does not contain any Component data. It only contains type information.

§Example


#[derive(Component)]
struct Apple;

#[derive(Component)]
struct Orange;

struct Fruit;

impl Kind for Fruit {
    type Filter = Or<(With<Apple>, With<Orange>)>;
}

#[derive(Resource, Deref, DerefMut)]
struct FruitBasket(Vec<Instance<Fruit>>);

fn collect_fruits(mut basket: ResMut<FruitBasket>, fruits: Query<Instance<Fruit>>) {
    for fruit in fruits.iter() {
        println!("{fruit:?}");
        basket.push(fruit);
    }
}

Implementations§

Source§

impl<T: Kind> Instance<T>

Source

pub const PLACEHOLDER: Self

Same as Entity::PLACEHOLDER, but for an Instance<T>.

Source

pub unsafe fn from_entity_unchecked(entity: Entity) -> Self

Creates a new instance of kind T from some Entity.

§Usage

This function is useful when you know an Entity is of a specific kind and you need an Instance<T> with no way to validate it.

See Instance::from_entity for a safer alternative.

§Safety

Assumes entity is a valid instance of kind T.

§Example

#[derive(Component)]
struct Apple;

fn init_apple(entity: Entity, commands: &mut Commands) -> Instance<Apple> {
    commands.entity(entity).insert(Apple);
    // SAFE: `entity` will be a valid instance of `Apple`.
    unsafe { Instance::from_entity_unchecked(entity) }
}
Source

pub fn entity(&self) -> Entity

Returns the Entity of this instance.

Source

pub fn cast_into<U: Kind>(self) -> Instance<U>
where T: CastInto<U>,

Converts this instance into an instance of another kind Kind U.

§Usage

A kind T is safety convertible to another kind U if T implements CastInto<U>.

See [kind] macro for usage examples.

Source

pub fn cast_into_any(self) -> Instance<Any>

Converts this instance into an instance of Kind Any.

§Usage

Any Instance<T> can be safely cast into an Instance<Any> using this function.

Source

pub unsafe fn cast_into_unchecked<U: Kind>(self) -> Instance<U>

Converts this instance into an instance of another kind Kind U without any validation.

§Usage

This function is useful when you know an Instance<T> is convertible to a specific type and you need an Instance<U> with no way to validate it.

Always prefer to explicitly declare safe casts using [kind] macro and use Instance::cast_into instead of this.

§Safety

Assumes this instance is also a valid Instance<U>.

Source§

impl<T: Component> Instance<T>

Source

pub fn from_entity(entity: EntityRef<'_>) -> Option<Self>

Creates a new instance of kind T from some EntityRef if the entity has a Component of type T.

Methods from Deref<Target = Entity>§

Trait Implementations§

Source§

impl<T: Component> AsRef<Instance<T>> for InstanceMut<'_, T>

Source§

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

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Component> AsRef<Instance<T>> for InstanceRef<'_, T>

Source§

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

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Kind> Clone for Instance<T>

Source§

fn clone(&self) -> Self

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

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

Performs copy-assignment from source. Read more
Source§

impl<T: Kind> Debug for Instance<T>

Source§

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

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

impl<T: Kind> Deref for Instance<T>

Source§

type Target = Entity

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: Kind> Display for Instance<T>

Source§

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

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

impl<'a, T: Kind> From<&InstanceCommands<'a, T>> for Instance<T>

Source§

fn from(commands: &InstanceCommands<'a, T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Component> From<&InstanceMut<'_, T>> for Instance<T>

Source§

fn from(item: &InstanceMut<'_, T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Component> From<&InstanceRef<'_, T>> for Instance<T>

Source§

fn from(item: &InstanceRef<'_, T>) -> Self

Converts to this type from the input type.
Source§

impl From<Entity> for Instance<Any>

Source§

fn from(entity: Entity) -> Self

Converts to this type from the input type.
Source§

impl<T: Kind> From<Instance<T>> for Entity

Source§

fn from(instance: Instance<T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: Kind> From<InstanceCommands<'a, T>> for Instance<T>

Source§

fn from(commands: InstanceCommands<'a, T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Component> From<InstanceMut<'_, T>> for Instance<T>

Source§

fn from(item: InstanceMut<'_, T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Component> From<InstanceRef<'_, T>> for Instance<T>

Source§

fn from(item: InstanceRef<'_, T>) -> Self

Converts to this type from the input type.
Source§

impl<T> FromReflect for Instance<T>
where Instance<T>: Any + Send + Sync, T: TypePath + Kind, Entity: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn from_reflect(reflect: &dyn PartialReflect) -> Option<Self>

Constructs a concrete instance of Self from a reflected value.
Source§

fn take_from_reflect( reflect: Box<dyn PartialReflect>, ) -> Result<Self, Box<dyn PartialReflect>>

Attempts to downcast the given value to Self using, constructing the value using from_reflect if that fails. Read more
Source§

impl<T> GetTypeRegistration for Instance<T>
where Instance<T>: Any + Send + Sync, T: TypePath + Kind, Entity: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn get_type_registration() -> TypeRegistration

Returns the default TypeRegistration for this type.
Source§

fn register_type_dependencies(registry: &mut TypeRegistry)

Registers other types needed by this type. Read more
Source§

impl<T: Kind> Hash for Instance<T>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: Kind> MapEntities for Instance<T>

Source§

fn map_entities<M: EntityMapper>(&mut self, entity_mapper: &mut M)

Updates all Entity references stored inside using entity_mapper. Read more
Source§

impl<T: Kind> Ord for Instance<T>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: Kind> PartialEq<Entity> for Instance<T>

Source§

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

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

const 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> PartialEq<Instance<T>> for Entity

Source§

fn eq(&self, other: &Instance<T>) -> bool

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

const 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> PartialEq for Instance<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§

const 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> PartialOrd for Instance<T>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T> PartialReflect for Instance<T>
where Instance<T>: Any + Send + Sync, T: TypePath + Kind, Entity: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn get_represented_type_info(&self) -> Option<&'static TypeInfo>

Returns the TypeInfo of the type represented by this value. Read more
Source§

fn try_apply(&mut self, value: &dyn PartialReflect) -> Result<(), ApplyError>

Tries to apply a reflected value to this value. Read more
Source§

fn reflect_kind(&self) -> ReflectKind

Returns a zero-sized enumeration of “kinds” of type. Read more
Source§

fn reflect_ref(&self) -> ReflectRef<'_>

Returns an immutable enumeration of “kinds” of type. Read more
Source§

fn reflect_mut(&mut self) -> ReflectMut<'_>

Returns a mutable enumeration of “kinds” of type. Read more
Source§

fn reflect_owned(self: Box<Self>) -> ReflectOwned

Returns an owned enumeration of “kinds” of type. Read more
Source§

fn try_into_reflect( self: Box<Self>, ) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>

Attempts to cast this type to a boxed, fully-reflected value.
Source§

fn try_as_reflect(&self) -> Option<&dyn Reflect>

Attempts to cast this type to a fully-reflected value.
Source§

fn try_as_reflect_mut(&mut self) -> Option<&mut dyn Reflect>

Attempts to cast this type to a mutable, fully-reflected value.
Source§

fn into_partial_reflect(self: Box<Self>) -> Box<dyn PartialReflect>

Casts this type to a boxed, reflected value. Read more
Source§

fn as_partial_reflect(&self) -> &dyn PartialReflect

Casts this type to a reflected value. Read more
Source§

fn as_partial_reflect_mut(&mut self) -> &mut dyn PartialReflect

Casts this type to a mutable, reflected value. Read more
Source§

fn reflect_partial_eq(&self, value: &dyn PartialReflect) -> Option<bool>

Returns a “partial equality” comparison result. Read more
Source§

fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>

Attempts to clone Self using reflection. Read more
Source§

fn apply(&mut self, value: &(dyn PartialReflect + 'static))

Applies a reflected value to this value. Read more
Source§

fn clone_value(&self) -> Box<dyn PartialReflect>

👎Deprecated since 0.16.0: to clone reflected values, prefer using reflect_clone. To convert reflected values to dynamic ones, use to_dynamic.
Clones Self into its dynamic representation. Read more
Source§

fn to_dynamic(&self) -> Box<dyn PartialReflect>

Converts this reflected value into its dynamic representation based on its kind. Read more
Source§

fn reflect_hash(&self) -> Option<u64>

Returns a hash of the value (which includes the type). Read more
Source§

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

Debug formatter for the value. Read more
Source§

fn is_dynamic(&self) -> bool

Indicates whether or not this type is a dynamic type. Read more
Source§

impl<T: Kind> QueryData for Instance<T>

Source§

const IS_READ_ONLY: bool = true

True if this query is read-only and may not perform mutable access.
Source§

type ReadOnly = Instance<T>

The read-only variant of this QueryData, which satisfies the ReadOnlyQueryData trait.
Source§

type Item<'a> = Instance<T>

The item returned by this WorldQuery This will be the data retrieved by the query, and is visible to the end user when calling e.g. Query<Self>::get.
Source§

fn shrink<'wlong: 'wshort, 'wshort>( item: Self::Item<'wlong>, ) -> Self::Item<'wshort>

This function manually implements subtyping for the query items.
Source§

unsafe fn fetch<'w>( _fetch: &mut Self::Fetch<'w>, entity: Entity, _table_row: TableRow, ) -> Self::Item<'w>

Fetch Self::Item for either the given entity in the current Table, or for the given entity in the current Archetype. This must always be called after WorldQuery::set_table with a table_row in the range of the current Table or after WorldQuery::set_archetype with an entity in the current archetype. Accesses components registered in WorldQuery::update_component_access. Read more
Source§

impl<T> Reflect for Instance<T>
where Instance<T>: Any + Send + Sync, T: TypePath + Kind, Entity: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

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

Returns the value as a Box<dyn Any>. Read more
Source§

fn as_any(&self) -> &dyn Any

Returns the value as a &dyn Any. Read more
Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Returns the value as a &mut dyn Any. Read more
Source§

fn into_reflect(self: Box<Self>) -> Box<dyn Reflect>

Casts this type to a boxed, fully-reflected value.
Source§

fn as_reflect(&self) -> &dyn Reflect

Casts this type to a fully-reflected value.
Source§

fn as_reflect_mut(&mut self) -> &mut dyn Reflect

Casts this type to a mutable, fully-reflected value.
Source§

fn set(&mut self, value: Box<dyn Reflect>) -> Result<(), Box<dyn Reflect>>

Performs a type-checked assignment of a reflected value to this value. Read more
Source§

impl<T: Kind> RelationshipSourceCollection for Instance<T>

Source§

type SourceIter<'a> = <Entity as RelationshipSourceCollection>::SourceIter<'a>

The type of iterator returned by the iter method. Read more
Source§

fn new() -> Self

Creates a new empty instance.
Source§

fn with_capacity(_capacity: usize) -> Self

Returns an instance with the given pre-allocated entity capacity. Read more
Source§

fn reserve(&mut self, additional: usize)

Reserves capacity for at least additional more entities to be inserted. Read more
Source§

fn add(&mut self, entity: Entity) -> bool

Adds the given entity to the collection. Read more
Source§

fn remove(&mut self, entity: Entity) -> bool

Removes the given entity from the collection. Read more
Source§

fn iter(&self) -> Self::SourceIter<'_>

Iterates all entities in the collection.
Source§

fn len(&self) -> usize

Returns the current length of the collection.
Source§

fn clear(&mut self)

Clears the collection.
Source§

fn shrink_to_fit(&mut self)

Attempts to save memory by shrinking the capacity to fit the current length. Read more
Source§

fn is_empty(&self) -> bool

Returns true if the collection contains no entities.
Source§

fn extend_from_iter(&mut self, entities: impl IntoIterator<Item = Entity>)

Add multiple entities to collection at once. Read more
Source§

impl<T> TupleStruct for Instance<T>
where Instance<T>: Any + Send + Sync, T: TypePath + Kind, Entity: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn field(&self, index: usize) -> Option<&dyn PartialReflect>

Returns a reference to the value of the field with index index as a &dyn Reflect.
Source§

fn field_mut(&mut self, index: usize) -> Option<&mut dyn PartialReflect>

Returns a mutable reference to the value of the field with index index as a &mut dyn Reflect.
Source§

fn field_len(&self) -> usize

Returns the number of fields in the tuple struct.
Source§

fn iter_fields(&self) -> TupleStructFieldIter<'_>

Returns an iterator over the values of the tuple struct’s fields.
Source§

fn to_dynamic_tuple_struct(&self) -> DynamicTupleStruct

Creates a new DynamicTupleStruct from this tuple struct.
Source§

fn clone_dynamic(&self) -> DynamicTupleStruct

👎Deprecated since 0.16.0: use to_dynamic_tuple_struct instead
Clones the struct into a DynamicTupleStruct.
Source§

fn get_represented_tuple_struct_info(&self) -> Option<&'static TupleStructInfo>

Will return None if TypeInfo is not available.
Source§

impl<T> TypePath for Instance<T>
where Instance<T>: Any + Send + Sync, T: TypePath + Kind,

Source§

fn type_path() -> &'static str

Returns the fully qualified path of the underlying type. Read more
Source§

fn short_type_path() -> &'static str

Returns a short, pretty-print enabled path to the type. Read more
Source§

fn type_ident() -> Option<&'static str>

Returns the name of the type, or None if it is anonymous. Read more
Source§

fn crate_name() -> Option<&'static str>

Returns the name of the crate the type is in, or None if it is anonymous. Read more
Source§

fn module_path() -> Option<&'static str>

Returns the path to the module the type is in, or None if it is anonymous. Read more
Source§

impl<T> Typed for Instance<T>
where Instance<T>: Any + Send + Sync, T: TypePath + Kind, Entity: FromReflect + TypePath + MaybeTyped + RegisterForReflection,

Source§

fn type_info() -> &'static TypeInfo

Returns the compile-time info for the underlying type.
Source§

impl<T: Kind> WorldQuery for Instance<T>

Source§

const IS_DENSE: bool = <T::Filter as WorldQuery>::IS_DENSE

Returns true if (and only if) every table of every archetype matched by this fetch contains all of the matched components. Read more
Source§

type Fetch<'a> = <<T as Kind>::Filter as WorldQuery>::Fetch<'a>

Per archetype/table state retrieved by this WorldQuery to compute Self::Item for each entity.
Source§

type State = <<T as Kind>::Filter as WorldQuery>::State

State used to construct a Self::Fetch. This will be cached inside QueryState, so it is best to move as much data / computation here as possible to reduce the cost of constructing Self::Fetch.
Source§

fn shrink_fetch<'wlong: 'wshort, 'wshort>( fetch: Self::Fetch<'wlong>, ) -> Self::Fetch<'wshort>

This function manually implements subtyping for the query fetches.
Source§

unsafe fn init_fetch<'w>( world: UnsafeWorldCell<'w>, state: &Self::State, last_change_tick: Tick, change_tick: Tick, ) -> Self::Fetch<'w>

Creates a new instance of Self::Fetch, by combining data from the World with the cached Self::State. Readonly accesses resources registered in WorldQuery::update_component_access. Read more
Source§

unsafe fn set_archetype<'w>( fetch: &mut Self::Fetch<'w>, state: &Self::State, archetype: &'w Archetype, table: &'w Table, )

Adjusts internal state to account for the next Archetype. This will always be called on archetypes that match this WorldQuery. Read more
Source§

unsafe fn set_table<'w>( fetch: &mut Self::Fetch<'w>, state: &Self::State, table: &'w Table, )

Adjusts internal state to account for the next Table. This will always be called on tables that match this WorldQuery. Read more
Source§

fn update_component_access( state: &Self::State, access: &mut FilteredAccess<ComponentId>, )

Adds any component accesses used by this WorldQuery to access. Read more
Source§

fn get_state(components: &Components) -> Option<Self::State>

Attempts to initialize a State for this WorldQuery type using read-only access to Components.
Source§

fn init_state(world: &mut World) -> Self::State

Creates and initializes a State for this WorldQuery type.
Source§

fn matches_component_set( state: &Self::State, set_contains_id: &impl Fn(ComponentId) -> bool, ) -> bool

Returns true if this query matches a set of components. Otherwise, returns false. Read more
Source§

fn set_access(_state: &mut Self::State, _access: &FilteredAccess<ComponentId>)

Sets available accesses for implementors with dynamic access such as FilteredEntityRef or FilteredEntityMut. Read more
Source§

impl<T: Kind> Copy for Instance<T>

Source§

impl<T: Kind> Eq for Instance<T>

Source§

impl<T: Kind> ReadOnlyQueryData for Instance<T>

Auto Trait Implementations§

§

impl<T> Freeze for Instance<T>

§

impl<T> RefUnwindSafe for Instance<T>
where T: RefUnwindSafe,

§

impl<T> Send for Instance<T>

§

impl<T> Sync for Instance<T>

§

impl<T> Unpin for Instance<T>
where T: Unpin,

§

impl<T> UnwindSafe for Instance<T>
where T: UnwindSafe,

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

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

Source§

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>

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)

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)

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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<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<T> DynHash for T
where T: DynEq + Hash,

Source§

fn as_dyn_eq(&self) -> &(dyn DynEq + 'static)

Casts the type to dyn Any.
Source§

fn dyn_hash(&self, state: &mut dyn Hasher)

Feeds this value into the given Hasher.
Source§

impl<T> DynamicTypePath for T
where T: TypePath,

Source§

impl<T> DynamicTyped for T
where T: Typed,

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> GetPath for T
where T: Reflect + ?Sized,

Source§

fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>

Returns a reference to the value specified by path. Read more
Source§

fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>

Returns a mutable reference to the value specified by path. Read more
Source§

fn path<'p, T>( &self, path: impl ReflectPath<'p>, ) -> Result<&T, ReflectPathError<'p>>
where T: Reflect,

Returns a statically typed reference to the value specified by path. Read more
Source§

fn path_mut<'p, T>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut T, ReflectPathError<'p>>
where T: Reflect,

Returns a statically typed mutable reference to the value specified by path. Read more
Source§

impl<S> GetTupleStructField for S
where S: TupleStruct,

Source§

fn get_field<T>(&self, index: usize) -> Option<&T>
where T: Reflect,

Returns a reference to the value of the field with index index, downcast to T.
Source§

fn get_field_mut<T>(&mut self, index: usize) -> Option<&mut T>
where T: Reflect,

Returns a mutable reference to the value of the field with index index, downcast to T.
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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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> ConditionalSend for T
where T: Send,

Source§

impl<T> Reflectable for T