ToBodyContent

Trait ToBodyContent 

Source
pub trait ToBodyContent {
    // Required methods
    fn to_json<'async_trait, T>(
        self,
    ) -> Pin<Box<dyn Future<Output = Result<ParsedJson<T>>> + Send + 'async_trait>>
       where T: 'async_trait + DeserializeOwned,
             Self: 'async_trait;
    fn to_text<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn to_bytes<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn to_empty<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

Helpers for consuming and parsing response bodies and handling parsing of an ApiError if the response is 4xx/5xx

Required Methods§

Source

fn to_json<'async_trait, T>( self, ) -> Pin<Box<dyn Future<Output = Result<ParsedJson<T>>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned, Self: 'async_trait,

Source

fn to_text<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,

Source

fn to_bytes<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait,

Source

fn to_empty<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,

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.

Implementations on Foreign Types§

Source§

impl ToBodyContent for Response

Source§

fn to_json<'async_trait, T>( self, ) -> Pin<Box<dyn Future<Output = Result<ParsedJson<T>>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned, Self: 'async_trait,

Source§

fn to_text<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

fn to_bytes<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

fn to_empty<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,

Implementors§