Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Overly restricted/constrained lifetimes #77

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading