Expand description
Policy context for passing metadata through execution.
The context module provides types for passing request-scoped data through policy execution, useful for logging, tracing, and correlation IDs.
§Examples
use do_over::context::{Context, ContextKey};
// Define a context key
static REQUEST_ID: ContextKey<String> = ContextKey::new("request_id");
// Create a context with data
let mut ctx = Context::new();
ctx.insert(&REQUEST_ID, "req-123".to_string());
// Retrieve data
if let Some(id) = ctx.get(&REQUEST_ID) {
println!("Request ID: {}", id);
}Modules§
- keys
- Common context keys for resilience operations.
Structs§
- Context
- A type-safe container for request-scoped data.
- Context
Key - A key for storing values in a Context.