Session-types in Rust



I just a beginner in Rust. So please be patient with me :slight_smile:

Im woking on session-types lib in Rust. my problem is how can I create a channel and make it accessible by all structs ?

for example:

I have those types
type Server = Recv<i64, Eps>;
type Client = ::Dual;

and two structs
struct Srv{
c: Chan <(),Server>,
struct Cli{
ch: Chan <(),Client>,

and in main I connect them which returns me two channels:
let (server,client) = session_channel();

My question is, how can I make the same pointer to same channels can be accessible by all structs? so that I can for example access c and ch from both structs?

I hope its clear :slight_smile:



You might be interested in

You probably want to use an Rc or Arc to share the channel


This was cross-posted to Stack Overflow.