pub struct StdioTransport { /* private fields */ }Expand description
Standard I/O transport implementation
§Interior Mutability Architecture
Following research-backed 2025 Rust async best practices:
state: std::sync::Mutex (short-lived locks, never held across .await)config: std::sync::Mutex (infrequent updates, short-lived locks)metrics: AtomicMetrics (lock-free counters, 10-100x faster than Mutex)- I/O streams: tokio::sync::Mutex (held across .await, necessary for async I/O)
Implementations§
Source§impl StdioTransport
impl StdioTransport
Sourcepub fn new() -> StdioTransport
pub fn new() -> StdioTransport
Create a new stdio transport
Sourcepub fn with_config(config: TransportConfig) -> StdioTransport
pub fn with_config(config: TransportConfig) -> StdioTransport
Create a stdio transport with custom configuration
Sourcepub fn with_event_emitter(
event_emitter: TransportEventEmitter,
) -> StdioTransport
pub fn with_event_emitter( event_emitter: TransportEventEmitter, ) -> StdioTransport
Create a stdio transport with event emitter
Trait Implementations§
Source§impl Debug for StdioTransport
impl Debug for StdioTransport
Source§impl Default for StdioTransport
impl Default for StdioTransport
Source§fn default() -> StdioTransport
fn default() -> StdioTransport
Returns the “default value” for a type. Read more
Source§impl Transport for StdioTransport
impl Transport for StdioTransport
Source§fn transport_type(&self) -> TransportType
fn transport_type(&self) -> TransportType
Returns the type of this transport.
Source§fn capabilities(&self) -> &TransportCapabilities
fn capabilities(&self) -> &TransportCapabilities
Returns the capabilities of this transport.
Source§fn state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = TransportState> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
fn state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = TransportState> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
Returns the current state of the transport.
Source§fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
Establishes a connection to the remote endpoint.
Source§fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
Closes the connection to the remote endpoint.
Source§fn send<'life0, 'async_trait>(
&'life0 self,
message: TransportMessage,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
message: TransportMessage,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
Sends a single message over the transport.
Source§fn receive<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<TransportMessage>, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
fn receive<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<TransportMessage>, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
Receives a single message from the transport in a non-blocking way.
Source§fn metrics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = TransportMetrics> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
fn metrics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = TransportMetrics> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
Returns a snapshot of the transport’s current performance metrics.
Source§fn endpoint(&self) -> Option<String>
fn endpoint(&self) -> Option<String>
Returns the endpoint address or identifier for this transport, if applicable.
Source§fn configure<'life0, 'async_trait>(
&'life0 self,
config: TransportConfig,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
fn configure<'life0, 'async_trait>(
&'life0 self,
config: TransportConfig,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
StdioTransport: 'async_trait,
Applies a new configuration to the transport.
Auto Trait Implementations§
impl Freeze for StdioTransport
impl !RefUnwindSafe for StdioTransport
impl Send for StdioTransport
impl Sync for StdioTransport
impl Unpin for StdioTransport
impl !UnwindSafe for StdioTransport
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more