Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
arifd committed Feb 6, 2024
1 parent 4ff4c57 commit 3513dd2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ impl<'x> MimeHeaders<'x> for Message<'x> {

impl<'x> MessagePart<'x> {
/// Returns the body part's contents as a `u8` slice
pub fn contents(&'x self) -> &'x [u8] {
pub fn contents(&self) -> &[u8] {
match &self.body {
PartType::Text(text) | PartType::Html(text) => text.as_bytes(),
PartType::Binary(bin) | PartType::InlineBinary(bin) => bin.as_ref(),
Expand All @@ -597,7 +597,7 @@ impl<'x> MessagePart<'x> {
}

/// Returns the body part's contents as a `str`
pub fn text_contents(&'x self) -> Option<&'x str> {
pub fn text_contents(&self) -> Option<&str> {
match &self.body {
PartType::Text(text) | PartType::Html(text) => text.as_ref().into(),
PartType::Binary(bin) | PartType::InlineBinary(bin) => {
Expand All @@ -609,7 +609,7 @@ impl<'x> MessagePart<'x> {
}

/// Returns the nested message
pub fn message(&'x self) -> Option<&Message<'x>> {
pub fn message(&self) -> Option<&Message<'x>> {
if let PartType::Message(message) = &self.body {
Some(message)
} else {
Expand All @@ -618,7 +618,7 @@ impl<'x> MessagePart<'x> {
}

/// Returns the sub parts ids of a MIME part
pub fn sub_parts(&'x self) -> Option<&[MessagePartId]> {
pub fn sub_parts(&self) -> Option<&[MessagePartId]> {
if let PartType::Multipart(parts) = &self.body {
Some(parts.as_ref())
} else {
Expand Down

0 comments on commit 3513dd2

Please sign in to comment.