Session-types in Rust


#1

Hello,

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:

thanks.


#2

You might be interested in https://github.com/Munksgaard/session-types

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


#3

This was cross-posted to Stack Overflow.