Skip to main content

Crate cano_macros

Crate cano_macros 

Source
Expand description

§cano-macros

Procedural macros backing the cano workflow engine.

The crate exposes one attribute macro per cano core trait, all of which perform the same async-fn-to-Pin<Box<dyn Future + Send>> rewrite that the async-trait crate does. Splitting the macro by trait name (rather than a single generic async_trait) gives a more self-documenting attribute at the developer side: #[cano::task] on impl Task is immediately scannable for what the impl is.

Available macros:

  • task — for impl Task (and the Task trait definition itself)
  • node — for impl Node and the Node trait
  • resource — for impl Resource and the Resource trait

All three are functionally identical; they differ only in name. New traits that need async-fn-in-dyn rewriting can ship their own cano-macros attribute alongside.

Attribute Macros§

node
Apply to impl Node for ... blocks, inherent impl X { ... } blocks, or the Node trait definition itself.
resource
Apply to impl Resource for ... blocks (or the Resource trait definition itself).
task
Apply to impl Task for ... blocks (or the Task trait definition itself).

Derive Macros§

FromResources
Derive a from_resources(&Resources<_>) -> CanoResult<Self> constructor that pulls each field out of a cano::Resources map.
Resource
Derive an empty cano::Resource impl (uses the trait’s default no-op setup / teardown).