pub struct Header<'a> { /* private fields */ }
Implementations§
Source§impl<'a> Header<'a>
impl<'a> Header<'a>
pub fn with_name_value<N: Into<SharedString<'a>>, V: Into<SharedString<'a>>>( name: N, value: V, ) -> Self
pub fn new<N: Into<SharedString<'a>>>( name: N, value: impl EncodeHeaderValue, ) -> Self
pub fn new_unstructured<N: Into<SharedString<'a>>, V: Into<SharedString<'a>>>( name: N, value: V, ) -> Self
pub fn assign(&mut self, v: impl EncodeHeaderValue)
Sourcepub fn write_header<W: Write>(&self, out: &mut W) -> Result<()>
pub fn write_header<W: Write>(&self, out: &mut W) -> Result<()>
Format the header into the provided output stream, as though writing it out as part of a mime part
Sourcepub fn to_header_string(&self) -> String
pub fn to_header_string(&self) -> String
Convenience method wrapping write_header that returns the formatted header as a standalone string
pub fn get_name(&self) -> &str
pub fn get_raw_value(&self) -> &str
pub fn as_content_transfer_encoding(&self) -> Result<MimeParameters>
pub fn as_content_disposition(&self) -> Result<MimeParameters>
pub fn as_content_type(&self) -> Result<MimeParameters>
Sourcepub fn as_mailbox_list(&self) -> Result<MailboxList>
pub fn as_mailbox_list(&self) -> Result<MailboxList>
Parse the header into a mailbox-list (as defined in
RFC 5322), which is how the From
and Resent-From
,
headers are defined.
Sourcepub fn as_mailbox(&self) -> Result<Mailbox>
pub fn as_mailbox(&self) -> Result<Mailbox>
Parse the header into a mailbox (as defined in
RFC 5322), which is how the Sender
and Resent-Sender
headers are defined.
pub fn as_address_list(&self) -> Result<AddressList>
pub fn as_message_id(&self) -> Result<MessageID>
pub fn as_content_id(&self) -> Result<MessageID>
pub fn as_message_id_list(&self) -> Result<Vec<MessageID>>
pub fn as_unstructured(&self) -> Result<String>
pub fn as_authentication_results(&self) -> Result<AuthenticationResults>
pub fn as_date(&self) -> Result<DateTime<FixedOffset>>
pub fn parse_headers<S>(header_block: S) -> Result<HeaderParseResult<'a>>where
S: IntoSharedString<'a>,
pub fn parse<S: Into<SharedString<'a>>>( header_block: S, ) -> Result<(Self, usize)>
Sourcepub fn rebuild(&self) -> Result<Self>
pub fn rebuild(&self) -> Result<Self>
Re-constitute the header. The header value will be parsed out according to the known schema of the associated header name, and the parsed form used to build a new version of the header. This has the side effect of “fixing” non-conforming elements, but may come at the cost of “losing” the non-sensical or otherwise out of spec elements in the rebuilt header