Module into_error_context

Module into_error_context 

Source
Expand description

Trait for converting types into structured error context.

This trait provides a unified interface for types that can be converted into ErrorContext, enabling flexible context attachment in error handling pipelines.

§Implementations

The trait is implemented for common types:

  • String - Converts to ErrorContext::Message
  • &str - Converts to ErrorContext::Message
  • ErrorContext - Identity conversion (no-op)

§Examples

use error_rail::{traits::IntoErrorContext, ErrorContext};

let ctx1 = "simple message".into_error_context();
let ctx2 = String::from("owned message").into_error_context();
let ctx3 = ErrorContext::tag("network").into_error_context();

Traits§

IntoErrorContext
Converts a type into an ErrorContext for error annotation.