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— forimpl Task(and theTasktrait definition itself)node— forimpl Nodeand theNodetraitresource— forimpl Resourceand theResourcetrait
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, inherentimpl X { ... }blocks, or theNodetrait definition itself. - resource
- Apply to
impl Resource for ...blocks (or theResourcetrait definition itself). - task
- Apply to
impl Task for ...blocks (or theTasktrait definition itself).
Derive Macros§
- From
Resources - Derive a
from_resources(&Resources<_>) -> CanoResult<Self>constructor that pulls each field out of acano::Resourcesmap. - Resource
- Derive an empty
cano::Resourceimpl (uses the trait’s default no-opsetup/teardown).