use dialectic::prelude::*; use std::error::Error; use tokio::io::{BufReader, Stdin, Stdout}; mod common; #[allow(unused)] use common::{demo, prompt}; #[tokio::main] async fn main() { demo::(&server, &client, usize::MAX).await; } /// The session from the client's perspective. type Client = Session! { // Fill this in... }; /// The implementation of the client. #[Transmitter(Tx for /* add types needed by session here */)] #[Receiver(Rx for /* add types needed by session here */)] async fn client( #[allow(unused)] mut input: BufReader, #[allow(unused)] mut output: Stdout, #[allow(unused_mut)] mut chan: Chan, ) -> Result<(), Box> where Tx::Error: Error + Send, Rx::Error: Error + Send, { // Do something with the channel... chan.close(); Ok(()) } /// The session from the server's perspective. type Server = ::Dual; /// The implementation of the server for each client connection. #[Transmitter(Tx for /* add types needed by session here */)] #[Receiver(Rx for /* add types needed by session here */ )] async fn server( #[allow(unused_mut)] mut chan: Chan, ) -> Result<(), Box> where Tx::Error: Error + Send, Rx::Error: Error + Send, { // Do something with the channel... chan.close(); Ok(()) }