pub struct ContentLengthReader<'a> { /* private fields */ }Expand description
Reads a body with a known Content-Length.
This reader validates that exactly length bytes are provided and
enforces the configured size limit.
Implementations§
Source§impl<'a> ContentLengthReader<'a>
impl<'a> ContentLengthReader<'a>
Sourcepub fn new(
buffer: &'a [u8],
length: usize,
config: &BodyConfig,
) -> Result<Self, BodyError>
pub fn new( buffer: &'a [u8], length: usize, config: &BodyConfig, ) -> Result<Self, BodyError>
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Returns true if all bytes have been read.
Sourcepub fn read(&mut self, dest: &mut [u8]) -> Result<usize, BodyError>
pub fn read(&mut self, dest: &mut [u8]) -> Result<usize, BodyError>
Read up to max_bytes into the provided buffer.
Returns the number of bytes read.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for ContentLengthReader<'a>
impl<'a> RefUnwindSafe for ContentLengthReader<'a>
impl<'a> Send for ContentLengthReader<'a>
impl<'a> Sync for ContentLengthReader<'a>
impl<'a> Unpin for ContentLengthReader<'a>
impl<'a> UnwindSafe for ContentLengthReader<'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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).