Module nemo::session_types
[−]
[src]
Session types encode the current state of a communication channel. It is not possible to change to another state without following the protocol.
As an example, if a client is in state Recv<usize, End>
, it cannot
do anything except receive a usize
. And when it is finished, it will
be in state End
, which means it can do nothing except close the channel.
Structs
Accept |
Accept either |
Choose |
Choose from |
End |
The session is at the end of communication. The channel can now be gracefully closed. |
Escape |
Escape from a nested scope by an arbitrary number of layers |
Finally |
Finally choose |
Nest |
Protocols ocassionally do not follow a linear path of behavior. It may
be necessary to return to a previous "state" in the protocol. However,
this cannot be expressed in the typesystem, because the type will fold
over itself infinitely. Instead, |
Recv |
The session expects to receive |
Send |
The session expects to send |
Traits
Acceptor |
This trait effectively posits that a protocol which handles |
Chooser |
This trait selects for the de-Bruijn index of a protocol embedded within
a |
SessionType |
All session types have duality. Two clients that communicate will always have a session type that is the dual of their counterpart. |