headers_core

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: Extend<HeaderValue>>(&self, values: &mut E);
}
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: Extend<HeaderValue>>(&self, values: &mut E)

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 Age

impl Header for Allow

impl Header for Cookie

impl Header for Date

impl Header for ETag

impl Header for Expect

impl Header for Expires

impl Header for Host

impl Header for IfMatch

impl Header for IfRange

impl Header for Location

impl Header for Origin

impl Header for Pragma

impl Header for Range

impl Header for Referer

impl Header for Server

impl Header for SetCookie

impl Header for Te

impl Header for Upgrade

impl Header for UserAgent

impl Header for Vary