Crate nemo [] [src]

Nemo provides session type abstractions for asynchronous networking protocols. It can be used to build high performance, memory safe and type-safe protocol implementations.

What are session types?

Session types allow you to encode the description of a protocol in the type system. The goal is to ensure that two clients can never disagree about their state or expectations when communicating. Through session types, it is possible to define protocols that must be implemented properly -- your code simply will not compile otherwise.

Modules

channels
peano

Peano numbers are natural numbers expressed as successions of zero. We use them in our API to provide "nested" protocol escaping, as you must indicate the number of layers you wish to escape from.

session_types

Session types encode the current state of a communication channel. It is not possible to change to another state without following the protocol.

Structs

Chan

Channels are provided to handlers to act as a "courier" for the session type and a guard for the IO backend.

Defer

Handlers must return Defer to indicate to the Session how to proceed in the future. Defer can be obtained by calling .defer() on the channel, or by calling .close() when the session is Eps.

Session

Sessions are containers of channels which store the current session type internally through a function pointer to a concrete handler.

Traits

Handler

Handler is implemented on Protocol for every session type you expect to defer, including the initial state.

IO

This trait describes a backend for a channel to expose a message passing interface.

Protocol

A Protocol describes the underlying protocol, including the "initial" session type. Handlers are defined over concrete Protocols to implement the behavior of a protocol in a given SessionType.