pub struct IncomingBody<T> { /* private fields */ }Expand description
A stream of Bytes, used when receiving bodies from the network.
Implementations§
Source§impl<T: IncomingMessage> IncomingBody<T>
impl<T: IncomingMessage> IncomingBody<T>
Sourcepub fn new(msg: T) -> Result<Self, ErrorCode>
pub fn new(msg: T) -> Result<Self, ErrorCode>
Creates a new IncomingBody from the given incoming message.
This initializes the body in an unstarted state and extracts the
Content-Length header if present. The resulting instance can later
transition into a streaming or consumed state.
Returns an ErrorCode if the content length is invalid or cannot
be determined.
Sourcepub fn take_unstarted(&mut self) -> Option<T>
pub fn take_unstarted(&mut self) -> Option<T>
Takes ownership of the inner message if the body has not yet been started.
This method replaces the internal state with [StartedState::Empty]
and returns the contained message if it was still in the
unstarted state. Returns None otherwise.
Trait Implementations§
Source§impl<T: IncomingMessage> Body for IncomingBody<T>
impl<T: IncomingMessage> Body for IncomingBody<T>
Auto Trait Implementations§
impl<T> !Freeze for IncomingBody<T>
impl<T> !RefUnwindSafe for IncomingBody<T>
impl<T> !Sync for IncomingBody<T>
impl<T> !UnwindSafe for IncomingBody<T>
impl<T> Send for IncomingBody<T>where
StartedState<T>: Send,
impl<T> Unpin for IncomingBody<T>where
StartedState<T>: Unpin,
impl<T> UnsafeUnpin for IncomingBody<T>where
StartedState<T>: 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