AddHeaders

Trait AddHeaders 

Source
pub trait AddHeaders<T, E>: Into<Result<T, E>>
where E: Into<Error>,
{ // Provided methods fn header(self, name: impl IntoHeaderName, value: HeaderValue) -> Result<T> { ... } fn headers(self, headers: &HeaderMap) -> Result<T> { ... } }
Expand description

Convenience trait to add headers to a serror::Result directly.

Provided Methods§

Source

fn header(self, name: impl IntoHeaderName, value: HeaderValue) -> Result<T>

Source

fn headers(self, headers: &HeaderMap) -> Result<T>

Some headers might want to be attached in both Ok case and Err case. Borrow headers here so they can be used later, as they will only be cloned in err case.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<R, T, E> AddHeaders<T, E> for R
where R: Into<Result<T, E>>, E: Into<Error>,