Enum actix_http::body::BodySize
source · pub enum BodySize {
None,
Sized(u64),
Stream,
}
Expand description
Body size hint.
Variants§
None
Implicitly empty body.
Will omit the Content-Length header. Used for responses to certain methods (e.g., HEAD
) or
with particular status codes (e.g., 204 No Content). Consumers that read this as a body size
hint are allowed to make optimizations that skip reading or writing the payload.
Sized(u64)
Known size body.
Will write Content-Length: N
header.
Stream
Unknown size body.
Will not write Content-Length header. Can be used with chunked Transfer-Encoding.
Implementations§
source§impl BodySize
impl BodySize
sourcepub fn is_eof(&self) -> bool
pub fn is_eof(&self) -> bool
Returns true if size hint indicates omitted or empty body.
Streams will return false because it cannot be known without reading the stream.
assert!(BodySize::None.is_eof());
assert!(BodySize::Sized(0).is_eof());
assert!(!BodySize::Sized(64).is_eof());
assert!(!BodySize::Stream.is_eof());
Trait Implementations§
impl Copy for BodySize
impl Eq for BodySize
impl StructuralPartialEq for BodySize
Auto Trait Implementations§
impl Freeze for BodySize
impl RefUnwindSafe for BodySize
impl Send for BodySize
impl Sync for BodySize
impl Unpin for BodySize
impl UnwindSafe for BodySize
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.