macro_rules! node {
(|$state:ident| async move $body:block) => { ... };
($name:expr, |$state:ident| async move $body:block) => { ... };
(|$state:ident, $config:ident| async move $body:block) => { ... };
($name:expr, |$state:ident, $config:ident| async move $body:block) => { ... };
}Expand description
Helper macro to create a node from an async closure.
§Forms
ⓘ
// Basic form (backward compatible) - body returns Result<()>
node!(|state| async move {
state.set("key", "value").await?;
Ok(())
})
// Named form - body returns Result<()>
node!("my_node", |state| async move {
state.set("key", "value").await?;
Ok(())
})
// With config - body returns Result<NodeOutput> or Result<()>
node!(|state, config| async move {
state.set("key", "value").await?;
Ok(NodeOutput::Done)
})
// Named with config
node!("my_node", |state, config| async move {
state.set("key", "value").await?;
Ok(())
})