Trait Select

Source
pub trait Select: 'static {
    type Target: Component;
    type Filter: Filter;
}
Expand description

A trait for selecting a certain Target from entities that meet All, Any, and None conditions.

§Example


#[derive(Component)] struct Ca;
#[derive(Component)] struct Cb;
#[derive(Component)] struct Cc;
#[derive(Component)] struct Cd;

struct Sa;
impl Select for Sa {
    type Target = Ca;
    type Filter = Fa;
}
struct Fa;
impl Filter for Fa {
    type All = Cb;
    type Any = (Cc, Cd);
    type None = ();
}

// Or simply
filter!(Sb, Target = Ca, All = Cb, Any = (Cc, Cd));

Required Associated Types§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§