use async_trait::async_trait;
use futures::stream::Stream;
use std::pin::Pin;
use std::sync::Arc;
use tokio::sync::Mutex;
use crate::errors::Result;
#[async_trait]
pub trait Transport: Send + Sync {
async fn connect(&mut self) -> Result<()>;
async fn write(&mut self, data: &str) -> Result<()>;
fn read_messages(
&mut self,
) -> Pin<Box<dyn Stream<Item = Result<serde_json::Value>> + Send + '_>>;
async fn close(&mut self) -> Result<()>;
#[allow(dead_code)]
fn is_ready(&self) -> bool;
async fn end_input(&mut self) -> Result<()>;
fn get_stdin(&self) -> Option<Arc<Mutex<Option<tokio::process::ChildStdin>>>> {
None
}
}