pub enum Body {
None,
Empty,
Bytes(Bytes),
Message(Box<dyn MessageBody>),
}
Expand description
Represents various types of http message body.
Variants§
None
Empty response. Content-Length
header is not set.
Empty
Zero sized response body. Content-Length
header is set to 0
.
Bytes(Bytes)
Specific response body.
Message(Box<dyn MessageBody>)
Generic message body.
Implementations§
source§impl Body
impl Body
sourcepub fn from_slice(s: &[u8]) -> Body
pub fn from_slice(s: &[u8]) -> Body
Create body from slice (copy)
sourcepub fn from_message<B: MessageBody + 'static>(body: B) -> Body
pub fn from_message<B: MessageBody + 'static>(body: B) -> Body
Create body from generic message body.
Trait Implementations§
source§impl<B> From<Body> for ResponseBody<B>
impl<B> From<Body> for ResponseBody<B>
source§impl<S, E> From<BodyStream<S, E>> for Bodywhere
S: Stream<Item = Result<Bytes, E>> + Unpin + 'static,
E: Error + 'static,
impl<S, E> From<BodyStream<S, E>> for Bodywhere S: Stream<Item = Result<Bytes, E>> + Unpin + 'static, E: Error + 'static,
source§fn from(s: BodyStream<S, E>) -> Body
fn from(s: BodyStream<S, E>) -> Body
Converts to this type from the input type.
source§impl<S> From<SizedStream<S>> for Bodywhere
S: Stream<Item = Result<Bytes, Box<dyn Error>>> + Unpin + 'static,
impl<S> From<SizedStream<S>> for Bodywhere S: Stream<Item = Result<Bytes, Box<dyn Error>>> + Unpin + 'static,
source§fn from(s: SizedStream<S>) -> Body
fn from(s: SizedStream<S>) -> Body
Converts to this type from the input type.
source§impl MessageBody for Body
impl MessageBody for Body
Auto Trait Implementations§
impl !RefUnwindSafe for Body
impl !Send for Body
impl !Sync for Body
impl Unpin for Body
impl !UnwindSafe for Body
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