pub trait HttpTransport:
Clone
+ Send
+ Sync
+ 'static {
// Required methods
fn decode_request<T>(
&self,
content_type: &str,
body: &[u8],
) -> Result<T, CoolError>
where T: for<'de> Deserialize<'de>;
fn encode_response<T>(
&self,
content_type: &str,
status: StatusCode,
value: &T,
) -> Result<Response<Body>, CoolError>
where T: Serialize + ?Sized;
fn encode_sequence_response<T>(
&self,
content_type: &str,
status: StatusCode,
values: &[T],
) -> Result<Response<Body>, CoolError>
where T: Serialize;
fn encode_sequence_error_response(
&self,
content_type: &str,
status: StatusCode,
value: &CoolErrorResponse,
) -> Result<Response<Body>, CoolError>;
}Required Methods§
fn decode_request<T>(
&self,
content_type: &str,
body: &[u8],
) -> Result<T, CoolError>where
T: for<'de> Deserialize<'de>,
fn encode_response<T>( &self, content_type: &str, status: StatusCode, value: &T, ) -> Result<Response<Body>, CoolError>
fn encode_sequence_response<T>(
&self,
content_type: &str,
status: StatusCode,
values: &[T],
) -> Result<Response<Body>, CoolError>where
T: Serialize,
fn encode_sequence_error_response( &self, content_type: &str, status: StatusCode, value: &CoolErrorResponse, ) -> Result<Response<Body>, 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.