#channels #async #actor #utils

messages

A midground between channels and actors

3 releases

0.1.2 Aug 4, 2020
0.1.1 Aug 4, 2020
0.1.0 Aug 4, 2020

#480 in Rust patterns

25 downloads per month

MIT license

11KB
163 lines

Messages. Convenient asynchronous communication

Status: CI

Project info: Docs.rs Latest Version License Rust 1.44+ required

Description

messages is a very simplistic library, which provides a more declarative interface than raw channels, but yet not overcomplicates things with too much functionality.

It is intended to be used when channels in your project start looking a bit messy, but you aren't sure that migrating to the actor framework is a right choice.

To compare channels-based implementation and the implementation that uses messages, see:

Why?

When your code has a plenty of channels (both mpsc and oneshot) it becomes hard to keep all of them in mind. More than that, since there are mpsc::Sender / oneshot::Sender (and same for Receiver), you either have to use type with module prefixes, or live with uncertainty.

This crate attempts to simplify things for users. There is no more need to think about types of channels: oneshot ones are hidden in Request objects, and mpsc lies inside Mailbox / Address. Every type name is unique and hard to misinterpret.

Hopefully, it may help to make code more readable.

Contributing

All kind of contributions is really appreciated!

License

messages library is licensed under the MIT License. See LICENSE for details.

Dependencies

~1.2–1.7MB
~37K SLoC