Struct mailparsing::Header
source · 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
Trait Implementations§
impl<'a> StructuralPartialEq for Header<'a>
Auto Trait Implementations§
impl<'a> Freeze for Header<'a>
impl<'a> RefUnwindSafe for Header<'a>
impl<'a> Send for Header<'a>
impl<'a> Sync for Header<'a>
impl<'a> Unpin for Header<'a>
impl<'a> UnwindSafe for Header<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)