ServerTransport

Trait ServerTransport 

Source
pub trait ServerTransport: Send + Sync {
    // Required methods
    fn read_message<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Option<Result<JsonRpcMessage>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn write_message<'life0, 'async_trait>(
        &'life0 mut self,
        msg: JsonRpcMessage,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn close<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

Source

fn read_message<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Option<Result<JsonRpcMessage>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reads a JSON-RPC message (could be a Request or Notification)

Source

fn write_message<'life0, 'async_trait>( &'life0 mut self, msg: JsonRpcMessage, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends a JSON-RPC message (usually a Response)

Provided Methods§

Source

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Closes the transport connection

Implementors§