[−][src]Trait mail::HeaderKind
Trait representing a mail header.
This is not meant to be implemented by hand.*
Use the def_headers
macro instead.
Associated Types
type Component: Clone + EncodableInHeader
the component representing the header-field, e.g. Unstructured
for Subject
Associated Constants
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
A function which is meant to be called with a reference
to the final header map before encoding the headers. It is
meant to be used do some of the contextual validations,
like e.g. a From
header might return a function which
checks if the From
header has multiple mailboxes and
if so checks if there is a Sender
header
Calling a contextual validator with a header map not containing a header which it is meant to validate should not cause an error. Only if the header is there and the component is of the expected type and it is invalid in the context an error should be returned.
const MAX_ONE: bool
I true this will assure that the header is at most one time in a header map.
This is similar to VALIDATOR
(and can be archived through one) but in difference
to any VALIDATOR
this is already assured when inserting a header with MAX_ONE set
to true in a header map. It exists so that the header map can do, what is most
intuitive, replacing insertion for all MAX_ONE
headers (like in a normal map) but
use adding insertion for all other header (like in a multi map).
Most headers have this set to true.
Required methods
fn name() -> HeaderName
a method returning the header name
Note:
Once const fn
is stable this will be changed to
a associated constant.
Provided methods
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
H: HeaderTryInto<Self::Component>,
Creates a Header
instance automatically converting given body to the right type.
Error
The type system assure that you can only use it on conversions
which are possible on type level, but they can still fail depending
on the actual data. For example creating a Email
from a string
can fail if the string is not a valid email address. This in
turn means that creating a From
header from a array of strings
can fail if one of them is not a valid email address.
fn body(body: Self::Component) -> Header<Self>
Creates a Header
instance for this header kind with given body.
Implementors
impl HeaderKind for Bcc
[src]
type Component = MailboxList
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for Cc
[src]
type Component = MailboxList
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for Comments
[src]
type Component = Unstructured
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ContentDescription
[src]
type Component = Unstructured
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ContentDisposition
[src]
type Component = Disposition
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ContentId
[src]
type Component = MessageId
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ContentTransferEncoding
[src]
type Component = TransferEncoding
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ContentType
[src]
type Component = MediaType
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for Date
[src]
type Component = DateTime
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for InReplyTo
[src]
type Component = MessageIdList
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for Keywords
[src]
type Component = PhraseList
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for MessageId
[src]
type Component = MessageId
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for Received
[src]
type Component = ReceivedToken
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for References
[src]
type Component = MessageIdList
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ReplyTo
[src]
type Component = MailboxList
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ResentBcc
[src]
type Component = OptMailboxList
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ResentCc
[src]
type Component = MailboxList
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ResentDate
[src]
type Component = DateTime
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ResentFrom
[src]
type Component = MailboxList
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ResentMsgId
[src]
type Component = MessageId
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ResentSender
[src]
type Component = Mailbox
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ResentTo
[src]
type Component = MailboxList
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for ReturnPath
[src]
type Component = Path
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for Sender
[src]
type Component = Mailbox
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for Subject
[src]
type Component = Unstructured
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for _From
[src]
type Component = MailboxList
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,
fn body(body: Self::Component) -> Header<Self>
[src]
impl HeaderKind for _To
[src]
type Component = MailboxList
fn name() -> HeaderName
[src]
const MAX_ONE: bool
[src]
const VALIDATOR: Option<fn(&HeaderMap) -> Result<(), HeaderValidationError>>
[src]
fn auto_body<H>(body: H) -> Result<Header<Self>, ComponentCreationError> where
H: HeaderTryInto<Self::Component>,
[src]
H: HeaderTryInto<Self::Component>,