mcprotocol_rs/transport/stdio/mod.rs
1use crate::{protocol::Message, Result};
2use async_trait::async_trait;
3
4pub mod client;
5pub mod server;
6
7/// Stdio transport trait
8#[async_trait]
9pub trait StdioTransport: Send + Sync {
10 /// Initialize the transport
11 async fn initialize(&mut self) -> Result<()>;
12 /// Send a message
13 async fn send(&self, message: Message) -> Result<()>;
14 /// Receive a message
15 async fn receive(&self) -> Result<Message>;
16 /// Close the connection
17 async fn close(&mut self) -> Result<()>;
18}
19
20// Re-export default implementations
21pub use self::client::DefaultStdioClient;
22pub use self::server::DefaultStdioServer;