Skip to main content

Header

Trait Header 

Source
pub trait Header: Sized {
    // Required methods
    fn header_name() -> HeaderName;
    fn decode(value: &HeaderValue) -> Option<Self>;
    fn encode(self) -> HeaderValue;
}
Expand description

A trait for any type which represents an HTTP header.

Required Methods§

Source

fn header_name() -> HeaderName

The name of the header.

Source

fn decode(value: &HeaderValue) -> Option<Self>

Decode the header from a HeaderValue.

Source

fn encode(self) -> HeaderValue

Encode the header into a HeaderValue.

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§