pub struct InMemoryTransport<R: ServiceRole> { /* private fields */ }Expand description
In-memory transport for connecting McpServer and McpClient in tests
Trait Implementations§
Source§impl<R: ServiceRole> Transport<R> for InMemoryTransport<R>
impl<R: ServiceRole> Transport<R> for InMemoryTransport<R>
type Error = InMemoryTransportError
Source§fn send(
&mut self,
item: TxJsonRpcMessage<R>,
) -> impl Future<Output = Result<(), Self::Error>> + Send + 'static
fn send( &mut self, item: TxJsonRpcMessage<R>, ) -> impl Future<Output = Result<(), Self::Error>> + Send + 'static
Send a message to the transport Read more
Source§fn receive(
&mut self,
) -> impl Future<Output = Option<RxJsonRpcMessage<R>>> + Send
fn receive( &mut self, ) -> impl Future<Output = Option<RxJsonRpcMessage<R>>> + Send
Receive a message from the transport, this operation is sequential.
Source§fn close(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send
fn close(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send
Close the transport
fn name() -> Cow<'static, str>
Auto Trait Implementations§
impl<R> !RefUnwindSafe for InMemoryTransport<R>
impl<R> !UnwindSafe for InMemoryTransport<R>
impl<R> Freeze for InMemoryTransport<R>where
Arc<Mutex<Sender<JsonRpcMessage<<R as ServiceRole>::Req, <R as ServiceRole>::Resp, <R as ServiceRole>::Not>>>>: Freeze,
Arc<Mutex<Receiver<JsonRpcMessage<<R as ServiceRole>::PeerReq, <R as ServiceRole>::PeerResp, <R as ServiceRole>::PeerNot>>>>: Freeze,
impl<R> Send for InMemoryTransport<R>where
Arc<Mutex<Sender<JsonRpcMessage<<R as ServiceRole>::Req, <R as ServiceRole>::Resp, <R as ServiceRole>::Not>>>>: Send,
Arc<Mutex<Receiver<JsonRpcMessage<<R as ServiceRole>::PeerReq, <R as ServiceRole>::PeerResp, <R as ServiceRole>::PeerNot>>>>: Send,
impl<R> Sync for InMemoryTransport<R>where
Arc<Mutex<Sender<JsonRpcMessage<<R as ServiceRole>::Req, <R as ServiceRole>::Resp, <R as ServiceRole>::Not>>>>: Sync,
Arc<Mutex<Receiver<JsonRpcMessage<<R as ServiceRole>::PeerReq, <R as ServiceRole>::PeerResp, <R as ServiceRole>::PeerNot>>>>: Sync,
impl<R> Unpin for InMemoryTransport<R>where
Arc<Mutex<Sender<JsonRpcMessage<<R as ServiceRole>::Req, <R as ServiceRole>::Resp, <R as ServiceRole>::Not>>>>: Unpin,
Arc<Mutex<Receiver<JsonRpcMessage<<R as ServiceRole>::PeerReq, <R as ServiceRole>::PeerResp, <R as ServiceRole>::PeerNot>>>>: Unpin,
impl<R> UnsafeUnpin for InMemoryTransport<R>where
Arc<Mutex<Sender<JsonRpcMessage<<R as ServiceRole>::Req, <R as ServiceRole>::Resp, <R as ServiceRole>::Not>>>>: UnsafeUnpin,
Arc<Mutex<Receiver<JsonRpcMessage<<R as ServiceRole>::PeerReq, <R as ServiceRole>::PeerResp, <R as ServiceRole>::PeerNot>>>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more