| Crates.io | fastn-context-macros |
| lib.rs | fastn-context-macros |
| version | 0.1.3 |
| created_at | 2025-09-17 13:43:39.910771+00 |
| updated_at | 2025-09-17 14:38:07.3104+00 |
| description | Procedural macros for fastn-context |
| homepage | https://github.com/fastn-stack/context |
| repository | https://github.com/fastn-stack/context |
| max_upload_size | |
| id | 1843333 |
| size | 7,954 |
Type-safe async context propagation for Rust applications.
fastn-context provides a clean, efficient way to manage async operation context and cancellation in Rust applications. It's designed for applications that need to track operation status, handle graceful shutdowns, and manage background tasks.
Add to your Cargo.toml:
[dependencies]
fastn-context = "0.1"
use fastn_context::Context;
#[fastn_context::main]
async fn main() -> eyre::Result<()> {
// Your async code here
// Context is automatically available and managed
Ok(())
}
use fastn_context::{Context, ContextStatus};
async fn my_operation(ctx: &Context) -> Result<String, Error> {
// Check for cancellation
ctx.cancelled().await;
// Update operation status
ctx.update_status("Processing data...").await;
// Your business logic
Ok("result".to_string())
}
Licensed under the Universal Permissive License (UPL-1.0).
Contributions welcome! Please open an issue to discuss major changes before submitting a PR.