Trait headers_ext::Header
source · pub trait Header {
const NAME: &'static HeaderName;
fn decode<'i, I>(values: &mut I) -> Result<Self, Error>
where
Self: Sized,
I: Iterator<Item = &'i HeaderValue>;
fn encode<E>(&self, values: &mut E)
where
E: Extend<HeaderValue>;
}
Expand description
A trait for any object that will represent a header field and value.
This trait represents the construction and identification of headers, and contains trait-object unsafe methods.
Required Associated Constants
sourceconst NAME: &'static HeaderName
const NAME: &'static HeaderName
The name of this header.
Required Methods
sourcefn decode<'i, I>(values: &mut I) -> Result<Self, Error>where
Self: Sized,
I: Iterator<Item = &'i HeaderValue>,
fn decode<'i, I>(values: &mut I) -> Result<Self, Error>where
Self: Sized,
I: Iterator<Item = &'i HeaderValue>,
Decode this type from an iterator of HeaderValue
s.
sourcefn encode<E>(&self, values: &mut E)where
E: Extend<HeaderValue>,
fn encode<E>(&self, values: &mut E)where
E: Extend<HeaderValue>,
Encode this type to a HeaderMap
.
This function should be infallible. Any errors converting to a
HeaderValue
should have been caught when parsing or constructing
this value.