[−][src]Trait saphir::header::Header
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
fn header_name() -> &'static str
Returns the name of the header field this belongs to.
This will become an associated constant once available.
fn parse_header<'a, T>(raw: &'a T) -> Result<Self, Error> where
T: RawLike<'a>,
T: RawLike<'a>,
Parse a header from a raw stream of bytes.
It's possible that a request can include a header field more than once,
and in that case, the slice will have a length greater than 1. However,
it's not necessarily the case that a Header is allowed to have more
than one field value. If that's the case, you should return None
if raw.len() > 1
.
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
Format a header to outgoing stream.
Most headers should be formatted on one line, and so a common pattern
would be to implement std::fmt::Display
for this type as well, and
then just call f.fmt_line(self)
.
Note
This has the ability to format a header over multiple lines.
The main example here is Set-Cookie
, which requires that every
cookie being set be specified in a separate line. Almost every other
case should only format as 1 single line.
Implementors
impl Header for AccessControlAllowOrigin
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<AccessControlAllowOrigin, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Expect
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Expect, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for IfMatch
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<IfMatch, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for IfNoneMatch
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<IfNoneMatch, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for IfRange
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<IfRange, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Pragma
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Pragma, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Range
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Range, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for ReferrerPolicy
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<ReferrerPolicy, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for RetryAfter
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<RetryAfter, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Vary
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Vary, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Accept
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Accept, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for AcceptCharset
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<AcceptCharset, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for AcceptEncoding
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<AcceptEncoding, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for AcceptLanguage
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<AcceptLanguage, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for AcceptRanges
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<AcceptRanges, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for AccessControlAllowCredentials
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(
raw: &'a T
) -> Result<AccessControlAllowCredentials, Error> where
T: RawLike<'a>,
[src]
raw: &'a T
) -> Result<AccessControlAllowCredentials, Error> where
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for AccessControlAllowHeaders
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<AccessControlAllowHeaders, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for AccessControlAllowMethods
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<AccessControlAllowMethods, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for AccessControlExposeHeaders
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<AccessControlExposeHeaders, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for AccessControlMaxAge
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<AccessControlMaxAge, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for AccessControlRequestHeaders
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<AccessControlRequestHeaders, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for AccessControlRequestMethod
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<AccessControlRequestMethod, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Allow
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Allow, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for CacheControl
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<CacheControl, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Connection
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Connection, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for ContentDisposition
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<ContentDisposition, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for ContentEncoding
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<ContentEncoding, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for ContentLanguage
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<ContentLanguage, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for ContentLength
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<ContentLength, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for ContentLocation
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<ContentLocation, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for ContentRange
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<ContentRange, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for ContentType
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<ContentType, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Cookie
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Cookie, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Date
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Date, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for ETag
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<ETag, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Expires
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Expires, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for From
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<From, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Host
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Host, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for IfModifiedSince
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<IfModifiedSince, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for IfUnmodifiedSince
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<IfUnmodifiedSince, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for LastEventId
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<LastEventId, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for LastModified
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<LastModified, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Link
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Link, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Location
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Location, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Origin
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Origin, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Prefer
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Prefer, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for PreferenceApplied
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<PreferenceApplied, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Referer
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Referer, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Server
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Server, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for SetCookie
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<SetCookie, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for StrictTransportSecurity
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<StrictTransportSecurity, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Te
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Te, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for TransferEncoding
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<TransferEncoding, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Upgrade
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Upgrade, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for UserAgent
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<UserAgent, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl Header for Warning
[src]
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Warning, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl<S> Header for Authorization<S> where
S: Scheme + Any,
<S as FromStr>::Err: 'static,
[src]
S: Scheme + Any,
<S as FromStr>::Err: 'static,
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<Authorization<S>, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,
fn fmt_header(&self, f: &mut Formatter) -> Result<(), Error>
[src]
impl<S> Header for ProxyAuthorization<S> where
S: Scheme + Any,
<S as FromStr>::Err: 'static,
[src]
S: Scheme + Any,
<S as FromStr>::Err: 'static,
fn header_name() -> &'static str
[src]
fn parse_header<'a, T>(raw: &'a T) -> Result<ProxyAuthorization<S>, Error> where
T: RawLike<'a>,
[src]
T: RawLike<'a>,