Skip to main content

HttpClientCodec

Trait HttpClientCodec 

Source
pub trait HttpClientCodec: CoolCodec {
    // Required methods
    fn accept_header_value(&self) -> &'static str;
    fn sequence_accept_header_value(&self) -> &'static str;
    fn decode_response<T>(
        &self,
        content_type: &str,
        body: &[u8],
    ) -> Result<T, CoolError>
       where T: DeserializeOwned;
    fn decode_sequence_response<T>(
        &self,
        content_type: &str,
        body: &[u8],
    ) -> Result<Vec<T>, CoolError>
       where T: DeserializeOwned;
}

Required Methods§

Source

fn accept_header_value(&self) -> &'static str

Source

fn sequence_accept_header_value(&self) -> &'static str

Source

fn decode_response<T>( &self, content_type: &str, body: &[u8], ) -> Result<T, CoolError>

Source

fn decode_sequence_response<T>( &self, content_type: &str, body: &[u8], ) -> Result<Vec<T>, CoolError>

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.

Implementors§

Source§

impl HttpClientCodec for CborCodec

Source§

impl HttpClientCodec for JsonCodec

Available on crate feature codec-json only.