pub trait BodyExtractExt: Sealed {
// Required methods
fn try_into_json<T>(
self,
) -> impl Future<Output = Result<T, OpaqueError>> + Send
where T: DeserializeOwned + Send + 'static;
fn try_into_string(
self,
) -> impl Future<Output = Result<String, OpaqueError>> + Send;
}
Expand description
An extension trait for Body
that provides methods to extract data from it.
Required Methods§
Sourcefn try_into_json<T>(self) -> impl Future<Output = Result<T, OpaqueError>> + Sendwhere
T: DeserializeOwned + Send + 'static,
fn try_into_json<T>(self) -> impl Future<Output = Result<T, OpaqueError>> + Sendwhere
T: DeserializeOwned + Send + 'static,
Try to deserialize the (contained) body as a JSON object.
Sourcefn try_into_string(
self,
) -> impl Future<Output = Result<String, OpaqueError>> + Send
fn try_into_string( self, ) -> impl Future<Output = Result<String, OpaqueError>> + Send
Try to turn the (contained) body in an utf-8 string.
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.