#[non_exhaustive]pub enum Body {
Empty,
Bytes(Vec<u8>),
Stream {
len: Option<u64>,
next: Box<dyn FnMut(&mut Vec<u8>) -> bool + Send>,
},
Upgrade(Upgrade),
}Expand description
a response body
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Empty
Bytes(Vec<u8>)
Stream
produced piece by piece and sent chunked: the callback appends the next piece to the
buffer and returns false after the last one (Content-Length when len is known)
Upgrade(Upgrade)
(G7d) with status 101: the server sends the head as it is (Connection and Upgrade as the
handler set them, no length), then hands the connection to the upgrade on a thread of its
own (ws::Acceptor::accept makes such answers). With any other status: no body
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Body
impl !Sync for Body
impl !UnwindSafe for Body
impl Forget for Body
impl Freeze for Body
impl Move for Body
impl Send for Body
impl Unpin for Body
impl UnsafeUnpin for Bodywhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const dyn FnMut(&mut Vec<u8>) -> bool + Send is !null: UnsafeUnpin,
PhantomData<dyn FnMut(&mut Vec<u8>) -> bool + Send>: UnsafeUnpin,
*const dyn FnOnce(Upgraded) + Send is !null: UnsafeUnpin,
PhantomData<dyn FnOnce(Upgraded) + Send>: UnsafeUnpin,
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