Trait ProtocolHandler

Source
pub trait ProtocolHandler<ServerContext, ConnectionContext, Ops>:
    DowncastSync
    + Sized
    + Send
    + Sync
where Ops: OpsT, ServerContext: Clone + Send + Sync + 'static, ConnectionContext: Clone + Send + Sync + 'static,
{ // Required methods fn new( methods: Arc<Interface<ServerContext, ConnectionContext, Ops>>, ) -> Self where Self: Sized; fn encoding(&self) -> Encoding; fn handle_message<'life0, 'life1, 'async_trait>( &'life0 self, connection_ctx: ConnectionContext, message: Message, sink: &'life1 WebSocketSink, ) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn serialize_notification_message<Msg>( &self, op: Ops, msg: Msg, ) -> Result<Message> where Msg: BorshSerialize + Serialize + Send + Sync + 'static; }
Expand description

Base trait for BorshProtocol and JsonProtocol protocol handlers

Required Methods§

Source

fn new(methods: Arc<Interface<ServerContext, ConnectionContext, Ops>>) -> Self
where Self: Sized,

Source

fn encoding(&self) -> Encoding

Source

fn handle_message<'life0, 'life1, 'async_trait>( &'life0 self, connection_ctx: ConnectionContext, message: Message, sink: &'life1 WebSocketSink, ) -> Pin<Box<dyn Future<Output = WebSocketResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn serialize_notification_message<Msg>( &self, op: Ops, msg: Msg, ) -> Result<Message>
where Msg: BorshSerialize + Serialize + Send + Sync + 'static,

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<ServerContext, ConnectionContext, Ops, Id> ProtocolHandler<ServerContext, ConnectionContext, Ops> for BorshProtocol<ServerContext, ConnectionContext, Ops, Id>
where ServerContext: Clone + Send + Sync + 'static, ConnectionContext: Clone + Send + Sync + 'static, Ops: OpsT, Id: IdT,

Source§

impl<ServerContext, ConnectionContext, Ops, Id> ProtocolHandler<ServerContext, ConnectionContext, Ops> for JsonProtocol<ServerContext, ConnectionContext, Ops, Id>
where ServerContext: Clone + Send + Sync + 'static, ConnectionContext: Clone + Send + Sync + 'static, Ops: OpsT, Id: IdT,