Skip to content

Commit

Permalink
Explain why len and is_empty can be None
Browse files Browse the repository at this point in the history
  • Loading branch information
Baptiste committed Feb 5, 2025
1 parent ac5d645 commit 71b2f35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ impl Body {
})
}

/// Get the length of the body in bytes.
/// Get the length of the body in bytes if defined. [None] if not.
///
/// # Examples
///
Expand All @@ -468,7 +468,7 @@ impl Body {
self.length
}

/// Returns `true` if the body has a length of zero, and `false` otherwise.
/// Returns `true` if the body has a length of zero, and `false` otherwise if length is defined. [None] if not.
pub fn is_empty(&self) -> Option<bool> {
self.length.map(|length| length == 0)
}
Expand Down

0 comments on commit 71b2f35

Please sign in to comment.