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
sourceimpl 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 StructuralEq for BodySize
impl StructuralPartialEq for BodySize
Auto Trait Implementations
impl RefUnwindSafe for BodySize
impl Send for BodySize
impl Sync for BodySize
impl Unpin for BodySize
impl UnwindSafe for BodySize
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized, 
 
impl<Q, K> Equivalent<K> for Q where
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized, 
sourcefn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
Compare self to key and return true if they are equal.
sourceimpl<T> Instrument for T
 
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
 
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
    S: Into<Dispatch>, 
 
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
    S: Into<Dispatch>, 
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
 
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more
