context

Macro context 

Source
macro_rules! context {
    ($($arg:tt)*) => { ... };
}
Expand description

Creates a lazily-evaluated error context that defers string formatting.

This macro wraps the provided format string and arguments in a LazyContext, which only evaluates the closure when the error actually occurs. This avoids the performance overhead of string formatting on the success path.

§Arguments

Accepts the same arguments as the standard format! macro.

§Examples

use error_rail::{context, ComposableError};

let user_id = 42;
let err = ComposableError::<&str>::new("auth failed")
    .with_context(context!("user_id: {}", user_id));