pub struct MockIo { /* private fields */ }Expand description
Mock I/O implementation for testing using DuplexStream
Implementations§
Source§impl MockIo
impl MockIo
Sourcepub fn new(stream: DuplexStream) -> Self
pub fn new(stream: DuplexStream) -> Self
Create a new MockIo instance from a DuplexStream
The DuplexStream should be the “server” side of the duplex pair. The “client” side should be used to send requests and read responses.
Sourcepub fn create_pair(buffer_size: usize) -> (Self, Self)
pub fn create_pair(buffer_size: usize) -> (Self, Self)
Create a pair of connected MockIo instances for testing
Returns (server_io, client_io) where:
- server_io: Used by the MCP server
- client_io: Used by tests to send requests and read responses
Trait Implementations§
Source§impl McpIo for MockIo
impl McpIo for MockIo
Source§fn read_line<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_line<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read a line from the input stream Read more
Auto Trait Implementations§
impl Freeze for MockIo
impl RefUnwindSafe for MockIo
impl Send for MockIo
impl Sync for MockIo
impl Unpin for MockIo
impl UnwindSafe for MockIo
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more