[][src]Trait lettre::message::header::Header

pub trait Header: 'static + HeaderClone + Send + Sync {
    fn header_name() -> &'static str;
fn parse_header<'a, T>(raw: &'a T) -> Result<Self, Error>
    where
        T: RawLike<'a>
;
fn fmt_header(&self, f: &mut Formatter<'_, '_>) -> Result<(), Error>; }

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>, 

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.

Loading content...

Implementations on Foreign Types

impl Header for Vary[src]

impl Header for Warning[src]

impl Header for Server[src]

impl Header for AcceptCharset[src]

impl Header for ETag[src]

impl Header for AccessControlAllowOrigin[src]

impl Header for ContentRange[src]

impl Header for AccessControlRequestHeaders[src]

impl Header for AcceptLanguage[src]

impl Header for ContentLength[src]

impl Header for ContentLanguage[src]

impl Header for AccessControlMaxAge[src]

impl Header for Upgrade[src]

impl Header for Referer[src]

impl Header for Connection[src]

impl Header for AccessControlExposeHeaders[src]

impl Header for IfRange[src]

impl Header for UserAgent[src]

impl Header for Expires[src]

impl Header for ReferrerPolicy[src]

impl Header for TransferEncoding[src]

impl Header for IfMatch[src]

impl Header for IfModifiedSince[src]

impl Header for LastEventId[src]

impl Header for IfUnmodifiedSince[src]

impl Header for Prefer[src]

impl Header for Host[src]

impl Header for From[src]

impl Header for AccessControlAllowHeaders[src]

impl<S> Header for ProxyAuthorization<S> where
    S: Scheme + Any,
    <S as FromStr>::Err: 'static, 
[src]

impl Header for IfNoneMatch[src]

impl Header for AccessControlRequestMethod[src]

impl Header for ContentEncoding[src]

impl Header for Origin[src]

impl Header for AcceptRanges[src]

impl Header for SetCookie[src]

impl Header for RetryAfter[src]

impl Header for AcceptEncoding[src]

impl Header for Accept[src]

impl<S> Header for Authorization<S> where
    S: Scheme + Any,
    <S as FromStr>::Err: 'static, 
[src]

impl Header for LastModified[src]

impl Header for AccessControlAllowMethods[src]

impl Header for AccessControlAllowCredentials[src]

impl Header for Expect[src]

impl Header for Pragma[src]

impl Header for Allow[src]

impl Header for Te[src]

impl Header for CacheControl[src]

impl Header for Location[src]

impl Header for Range[src]

impl Header for PreferenceApplied[src]

impl Header for StrictTransportSecurity[src]

Loading content...

Implementors

impl Header for ContentTransferEncoding[src]

impl Header for Bcc[src]

impl Header for Cc[src]

impl Header for Comments[src]

impl Header for ContentDisposition[src]

impl Header for ContentLocation[src]

impl Header for ContentType[src]

impl Header for Date[src]

impl Header for lettre::message::header::From[src]

impl Header for InReplyTo[src]

impl Header for Keywords[src]

impl Header for MessageId[src]

impl Header for MimeVersion[src]

impl Header for References[src]

impl Header for ReplyTo[src]

impl Header for Sender[src]

impl Header for Subject[src]

impl Header for To[src]

impl Header for lettre::message::header::UserAgent[src]

Loading content...