ServerEncoding

Trait ServerEncoding 

Source
pub trait ServerEncoding {
    // Required method
    fn into_dispatch(self) -> DispatchResult;
}
Expand description

Trait for encoding server responses into dispatch results.

This trait is automatically implemented for:

  • Result<T, E> where T: Serialize - unary responses
  • Result<RpcStream<T>, E> - streaming responses

The implementations don’t conflict because RpcStream<T> intentionally does not implement Serialize.

Required Methods§

Source

fn into_dispatch(self) -> DispatchResult

Convert this response into a dispatch result.

Implementations on Foreign Types§

Source§

impl<T: Serialize + Unpin + Send + 'static, E: Display> ServerEncoding for Result<RpcStream<T>, E>

Streaming response encoding for RpcStream results. This impl doesn’t conflict with the above because RpcStream doesn’t impl Serialize.

Source§

impl<T: Serialize, E: Display> ServerEncoding for Result<T, E>

Unary response encoding for any serializable Result type.

Implementors§