#[node]
Expand description
Marks an async function to be run in an ockam node.
The #[node]
macro transform an async input main function into a regular
output main function that sets up an ockam node and executes the body of
the input function inside the node.
The macro supports the following attributes:
-
#[ockam::node(crate = "...")]
: specify a path to the crate that will be used to import the items required by the macro. This can be helpful when using the macro from an internalockam
crate. Defaults toockam
. -
#[ockam::node(no_main)]: by default, this macro executes the provided function within the standard entry point function
main
. If your target device doesn’t support this entry point, use this argument to execute the input function within your own entry point as a separate function.
Example of use:
#[ockam::node]
async fn main(mut ctx: ockam::Context) -> ockam::Result<()> {
ctx.stop().await
}