Crate async_session_types

Source

Modules§

multiplexing
Multiplexing multiple protocols over a single channel and dispatching to session handler instances.

Macros§

offer
This macro is convenient for server-like protocols of the form:
repr_bound
The repr_bound macro creates a type alias that can be used as bound for the generic wire type, instead of listing all messages used by the protocol.
repr_impl
The repr_impl macro creates Repr implementations for a type used on the wire, for each protocol message type enumerated in the call.

Structs§

Chan
A session typed channel. P is the protocol and E is the environment, containing potential recursion targets. R is the representation of messages, which could be DynMessage, or perhaps something we know statically how to turn into JSON or bytes.
Choose
Active choice between P and Q
Eps
End of communication session (epsilon)
Offer
Passive choice (offer) between P and Q
Rec
Enter a recursive environment.
Recv
Receive T, then resume with protocol P.
S
Peano numbers: Increment
Send
Send T, then resume with protocol P.
Var
Recurse. N indicates how many layers of the recursive environment we recurse out of.
Z
Peano numbers: Zero

Enums§

Branch
Indicate whether the left or right choice was chosen in an Offer.
SessionError

Traits§

HasDual
The HasDual trait defines the dual relationship between protocols.
Incoming
Indicate that a protocol will receive a message, and specify what type it is, so we can decide in an offer which arm we got a message for.
Outgoing
Indicate that a protocol will send a message.
Repr
Define for the wire representation, so that the raw messages can be lifted into it, and later the representation can be cast back into the expected types.

Functions§

ok
session_channel
Create a pair of server and client channels for a given protocol P.
session_channel_dyn
Similar to session_channel; create a typed channel for a protocol P, but instead of creating a channel for its dual, return the raw sender and receiver that can be used to communicate with the channel created.

Type Aliases§

DynMessage
We can use a dynamic boxed message to pass messages, and represent all messages in a protocol as individual structs. However if we want to send them over a network connection we will need to serialise to some wire format, and at that point we have to use tagging, so we can recognise what type to deserialise into.
Receiver
Sender
SessionResult