pub trait BodyConversion: SealedBody{
// Provided methods
fn into_bytes(
self,
) -> impl Future<Output = Result<Bytes, BodyConvertError>> + Send { ... }
fn into_vec(
self,
) -> impl Future<Output = Result<Vec<u8>, BodyConvertError>> + Send { ... }
fn into_string(
self,
) -> impl Future<Output = Result<String, BodyConvertError>> + Send { ... }
unsafe fn into_string_unchecked(
self,
) -> impl Future<Output = Result<String, BodyConvertError>> + Send { ... }
fn into_faststr(
self,
) -> impl Future<Output = Result<FastStr, BodyConvertError>> + Send { ... }
unsafe fn into_faststr_unchecked(
self,
) -> impl Future<Output = Result<FastStr, BodyConvertError>> + Send { ... }
fn into_json<T>(
self,
) -> impl Future<Output = Result<T, BodyConvertError>> + Send
where T: DeserializeOwned { ... }
}Expand description
An extend trait for http_body::Body that can converting a body to other types
Provided Methods§
Sourcefn into_bytes(
self,
) -> impl Future<Output = Result<Bytes, BodyConvertError>> + Send
fn into_bytes( self, ) -> impl Future<Output = Result<Bytes, BodyConvertError>> + Send
Consume a body and convert it into Bytes.
Sourcefn into_vec(
self,
) -> impl Future<Output = Result<Vec<u8>, BodyConvertError>> + Send
fn into_vec( self, ) -> impl Future<Output = Result<Vec<u8>, BodyConvertError>> + Send
Consume a body and convert it into Vec<u8>.
Sourcefn into_string(
self,
) -> impl Future<Output = Result<String, BodyConvertError>> + Send
fn into_string( self, ) -> impl Future<Output = Result<String, BodyConvertError>> + Send
Consume a body and convert it into String.
Sourceunsafe fn into_string_unchecked(
self,
) -> impl Future<Output = Result<String, BodyConvertError>> + Send
unsafe fn into_string_unchecked( self, ) -> impl Future<Output = Result<String, BodyConvertError>> + Send
Sourcefn into_faststr(
self,
) -> impl Future<Output = Result<FastStr, BodyConvertError>> + Send
fn into_faststr( self, ) -> impl Future<Output = Result<FastStr, BodyConvertError>> + Send
Consume a body and convert it into FastStr.
Sourceunsafe fn into_faststr_unchecked(
self,
) -> impl Future<Output = Result<FastStr, BodyConvertError>> + Send
unsafe fn into_faststr_unchecked( self, ) -> impl Future<Output = Result<FastStr, BodyConvertError>> + Send
Sourcefn into_json<T>(
self,
) -> impl Future<Output = Result<T, BodyConvertError>> + Sendwhere
T: DeserializeOwned,
Available on crate feature json only.
fn into_json<T>(
self,
) -> impl Future<Output = Result<T, BodyConvertError>> + Sendwhere
T: DeserializeOwned,
json only.Consume a body and convert it into an instance with DeserializeOwned.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.