pub enum Body<R> {
Empty,
Preview {
bytes: Vec<u8>,
ieof: bool,
remainder: Remainder<R>,
},
Full {
reader: R,
},
}Expand description
Generic HTTP body used inside EmbeddedHttp.
Empty— no body (e.g., GET without payload, or OPTIONS).Preview— the firstNbytes are available inbytes, followed by theremainderstream.ieof=trueindicates the whole body already fits into the preview and no100 Continueis needed.Full— the complete body is available viareader.
Regular server routes normally receive Full bodies because the server owns
the RFC Preview handshake. Preview-aware routes may see Preview before
100 Continue is sent.
Variants§
Implementations§
Source§impl Body<BodyRead>
impl Body<BodyRead>
Sourcepub async fn ensure_full(
&mut self,
) -> IcapResult<&mut (dyn AsyncRead + Unpin + Send)>
pub async fn ensure_full( &mut self, ) -> IcapResult<&mut (dyn AsyncRead + Unpin + Send)>
Ensure a full stream is available.
If the body is currently Preview { .. } and ieof=false, this will
send ICAP/1.0 100 Continue exactly once, then convert the body into
Full { reader } where reader yields preview-bytes followed by the
remainder stream.
Trait Implementations§
Auto Trait Implementations§
impl<R> !RefUnwindSafe for Body<R>
impl<R> !UnwindSafe for Body<R>
impl<R> Freeze for Body<R>where
R: Freeze,
impl<R> Send for Body<R>where
R: Send,
impl<R> Sync for Body<R>where
R: Sync,
impl<R> Unpin for Body<R>where
R: Unpin,
impl<R> UnsafeUnpin for Body<R>where
R: 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