pub struct ErrorRailLayer<C> { /* private fields */ }Expand description
A Tower Layer that wraps service errors in ComposableError with context.
This layer intercepts errors from the wrapped service and adds the configured context, making it easy to add consistent error context at service boundaries.
§Type Parameters
C- The context type, must implementIntoErrorContextandClone
§Example
ⓘ
use error_rail::tower::ErrorRailLayer;
use tower::ServiceBuilder;
// Add static context
let layer = ErrorRailLayer::new("user-service");
// Or use structured context
let layer = ErrorRailLayer::new(error_rail::group!(
tag("service"),
metadata("version", "1.0")
));Implementations§
Trait Implementations§
Source§impl<C: Clone> Clone for ErrorRailLayer<C>
impl<C: Clone> Clone for ErrorRailLayer<C>
Source§fn clone(&self) -> ErrorRailLayer<C>
fn clone(&self) -> ErrorRailLayer<C>
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<C: Debug> Debug for ErrorRailLayer<C>
impl<C: Debug> Debug for ErrorRailLayer<C>
Auto Trait Implementations§
impl<C> Freeze for ErrorRailLayer<C>where
C: Freeze,
impl<C> RefUnwindSafe for ErrorRailLayer<C>where
C: RefUnwindSafe,
impl<C> Send for ErrorRailLayer<C>where
C: Send,
impl<C> Sync for ErrorRailLayer<C>where
C: Sync,
impl<C> Unpin for ErrorRailLayer<C>where
C: Unpin,
impl<C> UnwindSafe for ErrorRailLayer<C>where
C: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)