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
type Error
The error type which will be returned from from_header
.
Associated Constants
const NAME: &'static str
The name of HTTP header associated with this type.
const ALLOW_SKIP: bool
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
fn from_header(s: &[u8]) -> Result<Self, Self::Error>
Perform conversion from a byte sequence to a value of Self
.
Provided Methods
fn default() -> Option<Self>
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.