generic-session-types

Generic session types in Rust for async send recv channel

Prerequisites

Usage

Add dependency to Cargo.toml toml [dependencies] generic-session-types = "0.1.0"

Example

```rust

use genericsessiontypes::*;

type P2 = Send>;

[tokio::test]

async fn testtokiompscchannel2dynmessage() { let (client, server) = mpsc::channel::(10); let msg = String::from("asdfsdfds"); let h1: JoinHandle> = tokio::spawn(async move { send!(client, msg); recv!(client, r); close!(client); Ok(r) }); let h2: JoinHandle> = tokio::spawn(async move { let (s, c) = server.recv().await?; let c = c.send(s.len()).await?; c.close().await?; Ok(()) }); let r0 = h1.await.unwrap(); let r1 = h2.await.unwrap(); asserteq!(r0, Ok(9)); assert_eq!(r1, Ok(())); } ```

References