pub trait Header {
// Required methods
fn 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 Methods§
Sourcefn name() -> &'static HeaderName
fn name() -> &'static HeaderName
The name of this header.
Sourcefn decode<'i, I>(values: &mut I) -> Result<Self, Error>
fn decode<'i, I>(values: &mut I) -> Result<Self, Error>
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.
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§
impl Header for Accept
impl Header for AcceptRanges
impl Header for AccessControlAllowCredentials
impl Header for AccessControlAllowHeaders
impl Header for AccessControlAllowMethods
impl Header for AccessControlAllowOrigin
impl Header for AccessControlExposeHeaders
impl Header for AccessControlMaxAge
impl Header for AccessControlRequestHeaders
impl Header for AccessControlRequestMethod
impl Header for Age
impl Header for Allow
impl Header for CFConnectingIp
impl Header for CacheControl
impl Header for ClientIp
impl Header for Connection
impl Header for ContentDisposition
impl Header for ContentEncoding
impl Header for ContentLength
impl Header for ContentLocation
impl Header for ContentRange
impl Header for ContentType
impl Header for Cookie
impl Header for Date
impl Header for ETag
impl Header for Expect
impl Header for Expires
impl Header for Forwarded
Available on crate feature
http
only.