Trait finchers_http::header::FromHeader [] [src]

pub trait FromHeader: Sized {
    type Error;

    const NAME: &'static str;
    const ALLOW_SKIP: bool;

    fn from_header(s: &[u8]) -> Result<Self, Self::Error>;

    fn default() -> Option<Self> { ... }
}

Trait representing the conversion from an entry of HTTP header.

Associated Types

The error type which will be returned from from_header.

Associated Constants

The name of HTTP header associated with this type.

ALLOW_SKIP: bool = true

The flag whether the endpoint will skip the request if the header value is missing.

If the value of this flag is false, the endpoint will always accept the request and will return an error if the header value is missing.

Required Methods

Perform conversion from a byte sequence to a value of Self.

Provided Methods

Return the default value of Self used if the header value is missing.

If the returned value is None, it means that the header value is required and an error will be returned from the endpoint if the value is missing.

Implementors