Protocol

Trait Protocol 

Source
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§

Source

type Output

Source

type Error: StdError + Send + Sync + 'static

Source

type Message: Serialize + for<'a> Deserialize<'a>

Required Methods§

Source

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.

Implementors§

Source§

impl<L, E, S, Evt> Protocol for LogSync<L, E, S, Evt>
where L: LogId + for<'de> Deserialize<'de> + Serialize + Send + 'static, E: Extensions + Send + 'static, S: LogStore<L, E> + OperationStore<L, E> + Send + 'static, Evt: Debug + From<LogSyncEvent<E>> + Send + 'static,

Source§

impl<T, Evt> Protocol for TopicHandshakeAcceptor<T, Evt>
where T: Clone + Debug + for<'de> Deserialize<'de> + Serialize + Send + Sync + 'static, Evt: From<TopicHandshakeEvent<T>>,

Source§

impl<T, Evt> Protocol for TopicHandshakeInitiator<T, Evt>
where T: Clone + Debug + for<'de> Deserialize<'de> + Serialize + Send + Sync + 'static, Evt: From<TopicHandshakeEvent<T>>,

Source§

impl<T, S, M, L, E> Protocol for TopicLogSync<T, S, M, L, E>
where T: Debug + Eq + StdHash + Serialize + for<'a> Deserialize<'a> + Send + 'static, S: LogStore<L, E> + OperationStore<L, E> + Send + 'static, M: TopicMap<T, Logs<L>> + Send + 'static, L: LogId + for<'de> Deserialize<'de> + Serialize + Send + 'static, E: Extensions + Send + 'static,