[−][src]Trait dialectic::types::Session
A session type describes the sequence of operations performed by one end of a bidirectional
Chan
.
Each session type has a Session::Dual
, the type of the corresponding client on the other
side of the channel. The sealed trait Session
enumerates these types, and provides the dual of
each.
Examples
Here we define a Client
and Server
session type, which are duals of each other. This example
illustrates every construct in the language of session types.
use dialectic::types::*; type Client = Loop<Offer<(Split<Send<String, Done>, Recv<usize, Done>>, Recv<bool, Continue>)>>; type Server = Loop<Choose<(Split<Send<usize, Done>, Recv<String, Done>>, Send<bool, Continue>)>>; assert_type_eq_all!(Client, <Server as Session>::Dual);
Associated Types
type Dual: Session<Dual = Self>
[src]
The dual to this session type, i.e. the session type required of the other end of the channel.
Implementors
impl Session for Done
[src]
impl<Choices: Any> Session for Choose<Choices> where
Choices: Tuple,
Choices::AsList: EachSession,
<Choices::AsList as EachSession>::Dual: List + EachSession,
[src]
Choices: Tuple,
Choices::AsList: EachSession,
<Choices::AsList as EachSession>::Dual: List + EachSession,
impl<Choices: Any> Session for Offer<Choices> where
Choices: Tuple,
Choices::AsList: EachSession,
<Choices::AsList as EachSession>::Dual: List + EachSession,
[src]
Choices: Tuple,
Choices::AsList: EachSession,
<Choices::AsList as EachSession>::Dual: List + EachSession,
impl<N: Unary + Any> Session for Break<N>
[src]
All Break
s are valid session types.
impl<N: Unary + Any> Session for Continue<N>
[src]
impl<P: Session> Session for Loop<P>
[src]
impl<P: Session, Q: Session> Session for Seq<P, Q>
[src]
impl<P: Session, Q: Session> Session for Split<P, Q>
[src]
type Dual = Split<Q::Dual, P::Dual>
Note how the dual flips the position of P
and Q
, because P::Dual
is a receiving
session, and therefore belongs on the right of the split, and Q::Dual
is a sending
session, and therefore belongs on the left of the split.