Expand description
§fastn-context-macros
Procedural macros for the fastn-context
crate.
This crate provides the #[main]
attribute macro that simplifies setting up
fastn applications with automatic context management.
§Usage
Add the #[main]
attribute to your async main function to automatically set up
the tokio runtime and global context:
use fastn_context::main;
#[main]
async fn main() {
// Your application code here
// Global context is automatically available via fastn_context::global()
}
This is equivalent to:
#[tokio::main]
async fn main() {
// Manual setup would go here
}
But with automatic context initialization and cleanup.
Attribute Macros§
- main
- Main function attribute macro for fastn applications with context support.