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>;
fn encode_sequence_stream_response<T, S>(
&self,
content_type: &str,
status: StatusCode,
values: S,
) -> Result<Response<Body>, CoolError>
where T: Serialize + Send + 'static,
S: Stream<Item = Result<T, CoolError>> + Send + '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>
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>
Sourcefn encode_sequence_stream_response<T, S>(
&self,
content_type: &str,
status: StatusCode,
values: S,
) -> Result<Response<Body>, CoolError>
fn encode_sequence_stream_response<T, S>( &self, content_type: &str, status: StatusCode, values: S, ) -> Result<Response<Body>, CoolError>
Genuinely incremental counterpart to Self::encode_sequence_response
for @stream procedures (cratestack#283): values is encoded and
flushed item-by-item via axum::body::Body::from_stream instead
of collected into a Vec first. Only meaningful for
application/cbor-seq — implementations reject any other
content_type, mirroring how the higher-level
encode_transport_stream_result_with_status_for only calls this
when cbor-seq was negotiated (anything else falls back to the
buffered encode_sequence_response path there).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".