pub struct BodyReader<S> { /* private fields */ }Available on crate feature
http_support only.Expand description
Http body reader created by http parsers, see mod parse for more information.
Implementations§
Source§impl<S> BodyReader<S>
impl<S> BodyReader<S>
Source§impl<S> BodyReader<S>
impl<S> BodyReader<S>
Sourcepub async fn into_bytes(
self,
max_body_len: usize,
timeout: Option<Duration>,
) -> ParseResult<BytesMut>
pub async fn into_bytes( self, max_body_len: usize, timeout: Option<Duration>, ) -> ParseResult<BytesMut>
Consume BodyReader into BytesMut.
Use max_body_len to limit memory buf usage, which may be useful for server-side code.
Sourcepub async fn from_json<T>(self, timeout: Option<Duration>) -> ParseResult<T>where
for<'a> T: Deserialize<'a>,
pub async fn from_json<T>(self, timeout: Option<Duration>) -> ParseResult<T>where
for<'a> T: Deserialize<'a>,
Deserialize an instance of type T from http json format body.
The maximum body length is limited to 4096 bytes,
use from_json_with instead if you want to use other values.
Sourcepub async fn from_json_with<T>(
self,
max_body_len: usize,
timeout: Option<Duration>,
) -> ParseResult<T>where
for<'a> T: Deserialize<'a>,
pub async fn from_json_with<T>(
self,
max_body_len: usize,
timeout: Option<Duration>,
) -> ParseResult<T>where
for<'a> T: Deserialize<'a>,
Deserialize an instance of type T from http json format body.
Use max_body_len to limit memory buf usage, which may be useful for server-side code.
Trait Implementations§
Auto Trait Implementations§
impl<S> !Freeze for BodyReader<S>
impl<S> RefUnwindSafe for BodyReader<S>where
S: RefUnwindSafe,
impl<S> Send for BodyReader<S>where
S: Send,
impl<S> Sync for BodyReader<S>where
S: Sync,
impl<S> Unpin for BodyReader<S>where
S: Unpin,
impl<S> UnwindSafe for BodyReader<S>where
S: UnwindSafe,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more