Skip to main content

NamedHeader

Trait NamedHeader 

Source
pub trait NamedHeader: Sized + Send {
    const NAME: &'static str;

    // Required method
    fn decode(value: &str) -> Result<Self, String>;

    // Provided method
    fn schema(_registry: &mut SchemaRegistry) -> SchemaObject { ... }
}
Expand description

A typed HTTP header identified by a static name.

Required Associated Constants§

Source

const NAME: &'static str

Header name as sent on the wire (matched case-insensitively).

Required Methods§

Source

fn decode(value: &str) -> Result<Self, String>

Decode the header value.

§Errors

Returns a message describing why the value is invalid.

Provided Methods§

Source

fn schema(_registry: &mut SchemaRegistry) -> SchemaObject

JSON Schema for this header (defaults to a string).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl NamedHeader for Accept

Source§

const NAME: &'static str = "Accept"

Source§

impl NamedHeader for UserAgent

Source§

const NAME: &'static str = "User-Agent"