headers

Trait Header

Source
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§

Source

fn name() -> &'static HeaderName

The name of this header.

Source

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 HeaderValues.

Source

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§

Source§

impl Header for AcceptRanges

Source§

impl Header for AccessControlAllowCredentials

Source§

impl Header for AccessControlAllowHeaders

Source§

impl Header for AccessControlAllowMethods

Source§

impl Header for AccessControlAllowOrigin

Source§

impl Header for AccessControlExposeHeaders

Source§

impl Header for AccessControlMaxAge

Source§

impl Header for AccessControlRequestHeaders

Source§

impl Header for AccessControlRequestMethod

Source§

impl Header for Age

Source§

impl Header for Allow

Source§

impl Header for CacheControl

Source§

impl Header for Connection

Source§

impl Header for ContentDisposition

Source§

impl Header for ContentEncoding

Source§

impl Header for ContentLength

Source§

impl Header for ContentLocation

Source§

impl Header for ContentRange

Source§

impl Header for ContentType

Source§

impl Header for Date

Source§

impl Header for ETag

Source§

impl Header for Expect

Source§

impl Header for Expires

Source§

impl Header for Host

Source§

impl Header for IfMatch

Source§

impl Header for IfModifiedSince

Source§

impl Header for IfNoneMatch

Source§

impl Header for IfRange

Source§

impl Header for IfUnmodifiedSince

Source§

impl Header for LastModified

Source§

impl Header for Location

Source§

impl Header for Origin

Source§

impl Header for Pragma

Source§

impl Header for Range

Source§

impl Header for Referer

Source§

impl Header for ReferrerPolicy

Source§

impl Header for RetryAfter

Source§

impl Header for SecWebsocketAccept

Source§

impl Header for SecWebsocketKey

Source§

impl Header for SecWebsocketVersion

Source§

impl Header for Server

Source§

impl Header for SetCookie

Source§

impl Header for StrictTransportSecurity

Source§

impl Header for Te

Source§

impl Header for TransferEncoding

Source§

impl Header for Upgrade

Source§

impl Header for UserAgent

Source§

impl Header for Vary

Source§

impl<C: Credentials> Header for Authorization<C>

Source§

impl<C: Credentials> Header for ProxyAuthorization<C>