Bevy, a new Rust game engine and ECS, has a feature where it "scopes" its systems based on the type of the arguments. From its docs:
The parameters we pass in to a "system function" define what entities the system runs on. In this case, greet_people will run on all entities with the Person and Name component.
It looks like this:
struct Person;
struct Name(String);
fn greet_people(person: &Person, name: &Name) {
println!("hello {}", name.0);
}
How is Bevy able to make this happen? I thought I read somewhere that Rust didn't support reflection in this way.