pub enum Body {
Full(Vec<u8>),
Stream(Box<dyn FnOnce(&mut dyn Write) -> Result<()> + Send + 'static>),
}Expand description
A response body: either fully buffered, or streamed incrementally.
Streaming leans on the connection-per-request, Connection: close model:
we omit Content-Length, write the headers, then hand the raw socket to a
producer closure that flushes bytes over time. The client reads until the
connection closes (a valid HTTP/1.1 framing). No chunked encoding, no async.
Variants§
Auto Trait Implementations§
impl !RefUnwindSafe for Body
impl !Sync for Body
impl !UnwindSafe for Body
impl Freeze for Body
impl Send for Body
impl Unpin for Body
impl UnsafeUnpin 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