Skip to main content

TypeInfo

Enum TypeInfo 

Source
pub enum TypeInfo {
    Struct(StructInfo),
    TupleStruct(TupleStructInfo),
    Tuple(TupleInfo),
    List(ListInfo),
    Array(ArrayInfo),
    Map(MapInfo),
    Set(SetInfo),
    Enum(EnumInfo),
    Opaque(OpaqueInfo),
}
Expand description

Compile-time type information for various reflected types.

Generally, for any given type, this value can be retrieved in one of four ways:

  1. Typed::type_info
  2. DynamicTyped::reflect_type_info
  3. PartialReflect::get_represented_type_info
  4. TypeRegistry::get_type_info

Each returns a static reference to TypeInfo, but they all have their own use cases. For example, if you know the type at compile time, Typed::type_info is probably the simplest. If you have a dyn Reflect you can use DynamicTyped::reflect_type_info. If all you have is a dyn PartialReflect, you’ll probably want PartialReflect::get_represented_type_info. Lastly, if all you have is a TypeId or type path, you will need to go through TypeRegistry::get_type_info.

You may also opt to use TypeRegistry::get_type_info in place of the other methods simply because it can be more performant. This is because those other methods may require attaining a lock on the static TypeInfo, while the registry simply checks a map.

Variants§

§

Struct(StructInfo)

Type information for a struct-like type.

§

TupleStruct(TupleStructInfo)

Type information for a tuple-struct-like type.

§

Tuple(TupleInfo)

Type information for a tuple-like type.

§

List(ListInfo)

Type information for a list-like type.

§

Array(ArrayInfo)

Type information for an array-like type.

§

Map(MapInfo)

Type information for a map-like type.

§

Set(SetInfo)

Type information for a set-like type.

§

Enum(EnumInfo)

Type information for an enum-like type.

§

Opaque(OpaqueInfo)

Type information for an opaque type - see the OpaqueInfo docs for a discussion of opaque types.

Implementations§

Source§

impl TypeInfo

Source

pub fn ty(&self) -> &Type

The underlying Rust type.

Source

pub fn type_id(&self) -> TypeId

The TypeId of the underlying type.

Examples found in repository?
examples/reflection/mutation_by_reflection.rs (line 212)
95fn modify_selected_component(world: &mut World) {
96    // We're using keyboard input to trigger modifications for simplicity.
97    let button_input = world.resource::<ButtonInput<KeyCode>>();
98    let direction_of_modification = if button_input.pressed(KeyCode::ArrowUp) {
99        1.0
100    } else if button_input.pressed(KeyCode::ArrowDown) {
101        -1.0
102    } else {
103        return; // No modification requested
104    };
105
106    let selected = world.resource::<SelectedComponent>().clone();
107
108    let mut sprite_query = world.query_filtered::<Entity, With<Sprite>>();
109
110    // This entity should generally be gathered via UI selection in a real application
111    let entity = sprite_query.iter(world).next().unwrap();
112
113    // We could cheat and use `TypeId::of::<T>()` to get the type ID of a known type,
114    // but real applications identify types by name (from a UI dropdown, text entry or a script).
115    let type_name = match selected {
116        // Note that Bevy's native types are registered under their full subcrate paths:
117        // `bevy_transform`, not `bevy::transform`, `bevy::prelude`, or `bevy_transform::prelude`.
118        // You can use `<T as TypePath>::type_path()` to look this up.
119        SelectedComponent::Transform => "bevy_transform::components::transform::Transform",
120        SelectedComponent::Sprite => "bevy_sprite::sprite::Sprite",
121    };
122
123    // Then, we need to use a type registry to resolve the type name to a `TypeId`.
124    // Types are (for the most part) registered automatically by Bevy,
125    // but you can also register your own types using `App::register_type`.
126    // Generic types always need to be registered manually;
127    // if a type is not showing up in your tool, check if that's the problem.
128    // You can check which types are registered by calling `TypeRegistry::iter()`,
129    // and then use the `Debug` impl for `TypeRegistration` objects to see their names and paths.
130    let app_registry = world.resource::<AppTypeRegistry>().clone();
131    let type_id = app_registry
132        .read()
133        .get_with_type_path(type_name)
134        .expect("Type was not registered, or its full path was ambiguous")
135        .type_id();
136
137    let mut reflected_component: Mut<dyn Reflect> = world.get_reflect_mut(entity, type_id).unwrap();
138
139    match selected {
140        // Downcasting is the easy path:
141        // if you happen to know the type, you can downcast and modify directly.
142        // The problem is that each of these paths would need to be hard-coded (or rely on extensive code-gen),
143        // largely defeating the purpose of using reflection in the first place.
144        SelectedComponent::Sprite => {
145            // Make sure that the type matches the component type you requested to modify.
146            // In a real project, you would want to handle this gracefully.
147            // Downcasting converts the value *directly* into a specified concrete type,
148            // allowing you to escape back into faster, strongly-typed code.
149            let downcast_sprite: &mut Sprite =
150                reflected_component.downcast_mut::<Sprite>().unwrap();
151            // Be careful not to modify a copy of the color — use `&mut`!
152            let color = &mut downcast_sprite.color;
153
154            let new_alpha = (color.alpha() + 0.01 * direction_of_modification).clamp(0.0, 1.0);
155            color.set_alpha(new_alpha);
156        }
157        // This arm demonstrates the more realistic, generic pattern:
158        // walking the reflected type info to find fields to modify.
159        // The benefit is that we can use these patterns
160        // to operate over *any* data based on our knowledge of its shape (recorded using reflection),
161        // without needing to know the concrete type at compile time.
162        SelectedComponent::Transform => {
163            let reflect_mut: ReflectMut<'_> = reflected_component.reflect_mut();
164            // In the fully generic case, we would need to match on the `ReflectMut` variants
165            // and handle each of the arms exhaustively.
166            // `struct_mut` is of type `&mut dyn Struct`, one of a number
167            // of traits that encodes the logic of Rust's type system into a runtime representation.
168            let ReflectMut::Struct(struct_mut) = reflect_mut else {
169                error!("Expected the Transform component type to be a struct");
170                return;
171            };
172
173            // Get the `translation` field as a `&mut dyn PartialReflect`,
174            // which is a type-erased representation of a value that can be modified.
175            let translation_field = struct_mut.field_mut("translation").unwrap();
176
177            // Now, we can repeat the process to get the `y` field of the `translation` Vec3
178            // In a real application, this would probably be done via a recursive function!
179            let ReflectMut::Struct(translation_struct) = translation_field.reflect_mut() else {
180                error!("Expected the translation field to be a struct");
181                return;
182            };
183
184            // We could downcast to an f32 again here, but that would be cheating!
185            // How do you generalize this sort of operation, if, for example,
186            // you wanted to build a generic inspector that could modify any numeric field of any component type?
187            // The solution lies in the way that Bevy can reflect *traits* as well as types,
188            // allowing type owners to define and register additional behavior for their types.
189            // This data is registered automatically at compile time using an inventory-like solution,
190            // and operates on a per-type x per-trait basis,
191            // just like ordinary type reflection.
192            //
193            // We want to increase or decrease the value here,
194            // so we need the `AddAssign` trait
195            // which are already implemented for f32.
196            //
197            // But `AddAssign` is not a supertrait of `PartialReflect`!
198            // We don't have access to its methods! How could that possibly work?
199            //
200            // The solution is again to register the compile time information that we want to use at runtime;
201            // storing function pointers to the trait methods in the type registry.
202            // In order to make this work, we need shadow "reflect" versions of the traits we want to use at runtime.
203            // Bevy provides a few of these out of the box, including `ReflectAddAssign` and `ReflectSubAssign`.
204            // That's what the `#[reflect(Add)]` attributes that you see scattered about in Bevy's source code are doing:
205            // generating implementations of the reflect versions of the traits, so they can later be registered and used at runtime.
206            //
207            // For more information, see the `type_data` example.
208            let y_field: &mut dyn PartialReflect = translation_struct.field_mut("y").unwrap();
209            let field_type_id = y_field
210                .get_represented_type_info()
211                .expect("Found a dynamic type unexpectedly")
212                .type_id();
213
214            let add_assign_trait_data = app_registry
215                .read()
216                .get_type_data::<ReflectAddAssign>(field_type_id)
217                .expect("f32 failed to register ReflectAddAssign")
218                .clone();
219
220            // We need to operate on the value as a concrete type,
221            // so we need to convert it into the more powerful &dyn Reflect type.
222            let y_field: &mut dyn Reflect = y_field.try_as_reflect_mut().expect(
223                "Found a dynamic type unexpectedly, but we need a concrete type to modify it",
224            );
225
226            // We're still cheating a bit here!
227            // By doing this we just *assume* that there's an f32 value when trying to determine what to add to the field.
228            // We *could* try all of the common numeric types, but that would be slow and non-extensible.
229            //
230            // In a real workflow, you would want a dedicated trait with additional methods that exposes
231            // something like dedicated `increment` and `decrement` methods, which handle the type-specific logic of how to modify the value.
232            // Remember to register that trait, and create your own analog of `ReflectAddAssign` for it!
233            //
234            // We don't do that here to avoid making this example *even more* complicated.
235            const MAGNITUDE_OF_MODIFICATION: f32 = 10.;
236            let delta = direction_of_modification * MAGNITUDE_OF_MODIFICATION;
237            let boxed_delta: Box<dyn PartialReflect> = Box::new(delta);
238            add_assign_trait_data
239                .add_assign(y_field, boxed_delta)
240                .expect("We cheated and know the types match, so this should always succeed.");
241        }
242    }
243}
Source

pub fn type_path_table(&self) -> &TypePathTable

A representation of the type path of the underlying type.

Provides dynamic access to all methods on TypePath.

Source

pub fn type_path(&self) -> &'static str

The stable, full type path of the underlying type.

Use type_path_table if you need access to the other methods on TypePath.

Examples found in repository?
examples/reflection/generic_reflection.rs (line 28)
22fn setup(type_registry: Res<AppTypeRegistry>) {
23    let type_registry = type_registry.read();
24
25    let registration = type_registry.get(TypeId::of::<MyType<u32>>()).unwrap();
26    info!(
27        "Registration for {} exists",
28        registration.type_info().type_path(),
29    );
30
31    // MyType<String> was not manually registered, so it does not exist
32    assert!(type_registry.get(TypeId::of::<MyType<String>>()).is_none());
33}
Source

pub fn is<T>(&self) -> bool
where T: Any,

Check if the given type matches this one.

This only compares the TypeId of the types and does not verify they share the same TypePath (though it implies they do).

Source

pub fn docs(&self) -> Option<&str>

Available on crate feature reflect_documentation only.

The docstring of the underlying type, if any.

Source

pub fn kind(&self) -> ReflectKind

Returns the kind of this TypeInfo.

Source

pub fn generics(&self) -> &Generics

Gets the generic parameters for this type.

Source§

impl TypeInfo

Conversion convenience methods for TypeInfo.

Source

pub fn as_struct(&self) -> Result<&StructInfo, TypeInfoError>

Attempts a cast to StructInfo.

Returns an error if self is not TypeInfo::Struct.

Source

pub fn as_tuple_struct(&self) -> Result<&TupleStructInfo, TypeInfoError>

Attempts a cast to TupleStructInfo.

Returns an error if self is not TypeInfo::TupleStruct.

Source

pub fn as_tuple(&self) -> Result<&TupleInfo, TypeInfoError>

Attempts a cast to TupleInfo.

Returns an error if self is not TypeInfo::Tuple.

Source

pub fn as_list(&self) -> Result<&ListInfo, TypeInfoError>

Attempts a cast to ListInfo.

Returns an error if self is not TypeInfo::List.

Source

pub fn as_array(&self) -> Result<&ArrayInfo, TypeInfoError>

Attempts a cast to ArrayInfo.

Returns an error if self is not TypeInfo::Array.

Source

pub fn as_map(&self) -> Result<&MapInfo, TypeInfoError>

Attempts a cast to MapInfo.

Returns an error if self is not TypeInfo::Map.

Source

pub fn as_set(&self) -> Result<&SetInfo, TypeInfoError>

Attempts a cast to SetInfo.

Returns an error if self is not TypeInfo::Set.

Source

pub fn as_enum(&self) -> Result<&EnumInfo, TypeInfoError>

Attempts a cast to EnumInfo.

Returns an error if self is not TypeInfo::Enum.

Source

pub fn as_opaque(&self) -> Result<&OpaqueInfo, TypeInfoError>

Attempts a cast to OpaqueInfo.

Returns an error if self is not TypeInfo::Opaque.

Trait Implementations§

Source§

impl Clone for TypeInfo

Source§

fn clone(&self) -> TypeInfo

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeInfo

Source§

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

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

impl TypedProperty for TypeInfo

Source§

type Stored = TypeInfo

The type of the value stored in GenericTypeCell.

Auto Trait Implementations§

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, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

Source§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> ConditionalSend for T
where T: Send,

Source§

impl<T> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
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> 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> 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> 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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> FmtForward for T

Source§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
Source§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
Source§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
Source§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
Source§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
Source§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
Source§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
Source§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
Source§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> HitDataExtra for T
where T: Send + Sync + Debug + Any + 'static,

Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

impl<T> InitializeFromFunction<T> for T

Source§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<A> Is for A
where A: Any,

Source§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. Read more
Source§

impl<T> PatchTemplate for T
where T: Template,

Source§

fn patch_template<F>(func: F) -> TemplatePatch<F, T>
where F: FnOnce(&mut T, &mut ResolveContext<'_>),

Takes a “patch function” func that patches this Template, and turns it into a TemplatePatch.
Source§

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

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
Source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
Source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

Source§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
Source§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

Source§

fn super_from(input: T) -> O

Convert from a type to another type.
Source§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

Source§

fn super_into(self) -> O

Convert from a type to another type.
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
Source§

impl<T> Template for T
where T: Clone + Unpin,

Source§

type Output = T

The type of value produced by this Template.
Source§

fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>

Uses this template and the given entity context to produce a Template::Output.
Source§

fn clone_template(&self) -> T

Clones this template. See Clone.
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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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§

fn clone_type_data(&self) -> Box<dyn TypeData>

Creates a type-erased clone of self.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

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