pub trait Protocol: ProtocolCore + Clone {
    // Provided methods
    fn send_reply<S: SendNonBlocking<<Self as Messenger>::SendT> + ConnectionId>(
        &self,
        msg: &<Self as Messenger>::RecvT,
        sender: &mut S
    ) -> Result<(), Error> { ... }
    fn conf_heart_beat_interval(&self) -> Option<Duration> { ... }
    fn send_heart_beat<S: SendNonBlocking<<Self as Messenger>::SendT> + ConnectionId>(
        &self,
        sender: &mut S
    ) -> Result<SendStatus, Error> { ... }
}
Expand description

Full set of protocol features that will only work with Ref instances of crate::prelude::Clt and crate::prelude::Svc which includes crate::prelude::CltRecverRef, crate::prelude::CltSenderRef

§Important

Clone implementation of structure implementing Protocol must provide a CLEAN SLATE state instance, meaning any state captured by the Protocol methods must be erased. This is due to the fact that every new connection accepted by crate::prelude::SvcAcceptor will get a clone copy of the Protocol instance and each connection must maintain its own state.

Provided Methods§

source

fn send_reply<S: SendNonBlocking<<Self as Messenger>::SendT> + ConnectionId>( &self, msg: &<Self as Messenger>::RecvT, sender: &mut S ) -> Result<(), Error>

This is a hook to provide user space ability to perform scripted responses, example automatically emulate certain behavior . Called immediately after ProtocolCore::on_recv.

source

fn conf_heart_beat_interval(&self) -> Option<Duration>

source

fn send_heart_beat<S: SendNonBlocking<<Self as Messenger>::SendT> + ConnectionId>( &self, sender: &mut S ) -> Result<SendStatus, Error>

Object Safety§

This trait is not object safe.

Implementors§