pub struct RequestBody<'a> { /* private fields */ }Expand description
Incrementally collect a bounded request body in caller-owned storage. No
protocol output is possible until finish returns a complete body to parse.
Pass a validated Content-Length when known; otherwise the host supplies EOF.
Implementations§
Source§impl<'a> RequestBody<'a>
impl<'a> RequestBody<'a>
pub fn new( storage: &'a mut [u8], expected: Option<usize>, ) -> Result<RequestBody<'a>, Error>
Sourcepub fn push(&mut self, bytes: &[u8]) -> Result<(), Error>
pub fn push(&mut self, bytes: &[u8]) -> Result<(), Error>
Append all bytes or none. A rejected fragment leaves intake resumable.
pub fn received(&self) -> usize
Sourcepub fn cancel(&mut self)
pub fn cancel(&mut self)
Terminal cancellation. Drop this value to reuse its caller-owned storage.
pub fn finish(self) -> Result<&'a [u8], Error>
Auto Trait Implementations§
impl<'a> !UnwindSafe for RequestBody<'a>
impl<'a> Freeze for RequestBody<'a>
impl<'a> RefUnwindSafe for RequestBody<'a>
impl<'a> Send for RequestBody<'a>
impl<'a> Sync for RequestBody<'a>
impl<'a> Unpin for RequestBody<'a>
impl<'a> UnsafeUnpin for RequestBody<'a>
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