Trait moonshine_kind::Kind
source · pub trait Kind: 'static + Send + Sized + Sync {
type Filter: QueryFilter;
// Provided method
fn debug_name() -> String { ... }
}Expand description
A type which represents the kind of an Entity.
An entity is of kind T if it matches Query<Entity, <T as Kind>::Filter>.
By default, an entity with a Component of type T is also of kind T.
§Examples
#[derive(Component)]
struct Apple;
#[derive(Component)]
struct Orange;
struct Fruit;
impl Kind for Fruit {
type Filter = Or<(With<Apple>, With<Orange>)>;
}
fn fruits(query: Query<Instance<Fruit>>) {
for fruit in query.iter() {
println!("{fruit:?}");
}
}Required Associated Types§
type Filter: QueryFilter
Provided Methods§
sourcefn debug_name() -> String
fn debug_name() -> String
Returns the debug name of this kind.
By default, this is the short type name (without path) of this kind.
Object Safety§
This trait is not object safe.