macro_rules! decorator {
($plugin_name:ident : $name:expr; child($child_binding:ident),create: $create:expr,) => { ... };
(
$plugin_name:ident :
$name:expr; child($child_binding:ident),params($params_binding:ident):
$params_ty:path,create:
$create:expr,
) => { ... };
}Expand description
Creates a decorator plugin for nodes that wrap a single child.
Minimal example with a bound child node:
struct Invert<N>
{
child: N,
}
impl<N> Invert<N>
where
N: Node,
{
fn new(child: N) -> Self {
Self { child }
}
}
impl<N> Node for Invert<N>
where
N: Node,
{
fn tick(&mut self) -> TickStatus {
}
}
decorator!(
InvertPlugin: "Invert";
child(child),
create: Invert::new(child),
);Parameters can be attached the same way as in action!.