Trait HeaderEncode
pub trait HeaderEncode: TypedHeader {
// Required method
fn encode<E>(&self, values: &mut E)
where E: Extend<HeaderValue>;
// Provided method
fn encode_to_value(&self) -> Option<HeaderValue> { ... }
}Available on crate feature
http only.Expand description
A typed header which can be encoded into one or multiple headers.
Required Methods§
fn 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 HeaderValue, and add it to a container
which has HeaderValue type as each element.
This function should be infallible. Any errors converting to a
HeaderValue should have been caught when parsing or constructing
this value.
Provided Methods§
fn encode_to_value(&self) -> Option<HeaderValue>
fn encode_to_value(&self) -> Option<HeaderValue>
Encode this header to HeaderValue.
None is returned in case no header was encoded.
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.