Type Alias bevy_query_ext::prelude::AsDeref
source · pub type AsDeref<T> = ModQ<AsDerefQ<T>>;
Expand description
Returns the dereferenced component
§Example
#[derive(Component, Deref)]
struct WrappedBool(bool);
fn example(query: Query<AsDeref<WrappedBool>>) {
let _: &bool = query.get_single().unwrap();
}
§Counter Example: Type must be Deref
ⓘ
#[derive(Component)]
struct WrappedBool(bool);
fn bad_example(query: Query<AsDeref<WrappedBool>>) {
let _: &bool = query.get_single().unwrap();
}
§Counter Example: Nested Derefs are not currently supported
ⓘ
#[derive(Component,Deref)]
struct WrappedBool(bool);
#[derive(Component,Deref)]
struct Wwb(WrappedBool);
fn bad_example(query: Query<AsDeref<AsDeref<WrappedBool>>>) {
let _: &bool = query.get_single().unwrap();
}
Aliased Type§
struct AsDeref<T>(/* private fields */);