pub trait Protocol {
type Output;
type Error: StdError + Send + Sync + 'static;
type Message: Serialize + for<'a> Deserialize<'a>;
// Required method
fn run(
self,
sink: &mut (impl Sink<Self::Message, Error = impl Debug> + Unpin),
stream: &mut (impl Stream<Item = Result<Self::Message, impl Debug>> + Unpin),
) -> impl Future<Output = Result<Self::Output, Self::Error>>;
}Expand description
Generic protocol interface which runs over a sink and stream pair.
Required Associated Types§
type Output
type Error: StdError + Send + Sync + 'static
type Message: Serialize + for<'a> Deserialize<'a>
Required Methods§
fn run( self, sink: &mut (impl Sink<Self::Message, Error = impl Debug> + Unpin), stream: &mut (impl Stream<Item = Result<Self::Message, impl Debug>> + Unpin), ) -> impl Future<Output = Result<Self::Output, Self::Error>>
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.