Skip to main content

node

Attribute Macro node 

Source
#[node]
Expand description

Apply to impl Node for ... blocks, inherent impl X { ... } blocks, or the Node trait definition itself.

Two surface forms are supported on impl blocks:

  1. Trait-impl form (legacy): #[node] impl Node<S> for X { ... }. The macro infers type PrepResult / type ExecResult from the return types of prep and exec, and supplies a default fn config(&self) -> TaskConfig when missing.
  2. Inherent-impl form: #[node(state = S [, key = K])] impl X { ... }. The macro builds the impl Node<S [, K]> for X header from the attribute args, enforces that prep / exec / post are present, and injects the same boilerplate as form 1.

On a trait definition (#[node] pub trait Node ...) the macro just performs the async-fn-in-trait rewrite.