request!() { /* proc-macro */ }Expand description
Implements Request for the type.
Functions implement the Request by the crate internally, but others
such as struct or enum don’t. You must implement the Request yourself
if you want it to act as a system. This macro helps you write just a
little bit of code for that.
§Examples
use my_ecs::prelude::*;
#[derive(Component)] struct Ca;
#[derive(Component)] struct Cb;
#[derive(Resource)] struct Ra(i32);
#[derive(Resource)] struct Rb(i32);
filter!(Fa, Target = Ca);
filter!(Fb, Target = Cb);
filter!(Fc, All = (Ca, Cb));
// Declares `Req` with an implementation of `Request`.
// You can omit Read, Write, ResRead, ResWrite, or EntWrite.
request!(Req, Read = Fa, Write = Fb, ResRead = Ra, ResWrite = Rb, EntWrite = Fc);
struct Sys {
data: String,
}
impl System for Sys {
type Request = Req;
fn run(&mut self, resp: Response<'_, Self::Request>) { /* ... */ }
}