Crates.io | nemo |
lib.rs | nemo |
version | 0.2.1 |
source | src |
created_at | 2015-10-21 07:27:23.561325 |
updated_at | 2015-12-11 23:54:29.779751 |
description | Session types for asynchronous networking |
homepage | https://github.com/ebfull/nemo |
repository | https://github.com/ebfull/nemo |
max_upload_size | |
id | 3275 |
size | 42,733 |
Nemo is a Rust language session types library which focuses on asynchronous networking interfaces. Session types are a way of embedding a protocol into the typesystem, such that the implementation of it must be correct, or the code simply cannot compile. The standard of "correct" is that no client will disagree on the expectations or state of another. Session types can be used to enforce that only certain messages can be sent in particular orders over the network. Session types can embed much more complicated logic to handle protocols which involve nested or recursive state changes.
The session_types
crate is where nemo draws most of its inspiration. In order to support asynchronous channels and generic IO backends, it is designed differently so that you may defer a channel's handler to a future time -- perhaps when another event takes place on the network, or when it is convenient to resume work. If you never defer, there is no runtime cost, and when you do, the runtime cost is only one layer of indirection, sans code inlining. This change not only allows for async IO primitives, but also removes restrictions and requirements of end-user code.
Nemo provides an IO
trait for implementing backends. As an example, nemo provides nemo::channels::Blocking
which uses a backing bi-directional MPSC abstraction for safe communication between threads.