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

Channels are implementations of IO which can be used when building Session and designing protocols.

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.

Macros

peano!
proto!

Structs

Channel

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 End.

Traits

Handler

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

IO
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.

Transfers

This trait describes a backend for a channel to expose a message passing interface. The trait is unsafe because it will be asked to supply arbitrary types, and so must preserve the invariant that it will never allow the backing channel to be modified outside of this trait.

Functions

channel
channel_dual