use anyhow::Result;
use async_trait::async_trait;
use tokio::sync::broadcast::Receiver;
use super::Channel;
pub type TOnRemoteChannelReader = Receiver<Box<dyn Channel>>;
#[async_trait]
pub trait Disconnected: Send {
async fn connect(mut self: Box<Self>) -> Result<Box<dyn Connected>>;
async fn accept_connection(mut self: Box<Self>) -> Result<Box<dyn Connected>>;
}
#[async_trait]
pub trait Connected: Send {
fn on_remote_channel(&mut self) -> Result<TOnRemoteChannelReader>;
fn off_remote_channel(&mut self, data: TOnRemoteChannelReader) -> Result<()>;
async fn channel(&mut self, label: String, buffer_size: usize) -> Result<Box<dyn Channel>>;
}