Trait Transport

Source
pub trait Transport:
    Send
    + Sync
    + 'static {
    // Required methods
    fn send<'life0, 'async_trait>(
        &'life0 self,
        message: Message,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn receive(
        &self,
    ) -> Pin<Box<dyn Stream<Item = Result<Message, Error>> + Send>>;
    fn close<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for implementing MCP transports

Required Methods§

Source

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

Send a message over the transport

Source

fn receive(&self) -> Pin<Box<dyn Stream<Item = Result<Message, Error>> + Send>>

Receive messages from the transport

Source

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

Close the transport

Implementors§