We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Body::is_empty()
1 parent b79f8d3 commit 2f45d53Copy full SHA for 2f45d53
src/proto/body.rs
@@ -49,6 +49,22 @@ impl Body {
49
let (tx, rx) = channel();
50
(tx.tx, rx)
51
}
52
+
53
+ /// Returns if this body was constructed via `Body::empty()`.
54
+ ///
55
+ /// # Note
56
57
+ /// This does **not** detect if the body stream may be at the end, or
58
+ /// if the stream will not yield any chunks, in all cases. For instance,
59
+ /// a streaming body using `chunked` encoding is not able to tell if
60
+ /// there are more chunks immediately.
61
+ #[inline]
62
+ pub fn is_empty(&self) -> bool {
63
+ match self.0 {
64
+ Inner::Empty => true,
65
+ _ => false,
66
+ }
67
68
69
70
impl Default for Body {
0 commit comments