Announcing Postage, an async channel library

Hi Everyone,
I'm excited to announce postage, a library that makes it easier to write message-based applications in async rust.

Postage provides

  • A rich set of channels: mpsc, broadcast, oneshot, watch, and barrier channels
  • Sink and Stream combinators: map/filter/merge/chain, as well as a logging combinator for easy debugging
  • Portability, as channels are compatible with any executor (currently integration tests are written for tokio and async-std).

Links:

2 Likes

Interesting, I'll be sure to take a look.

My biggest problem with channels was communicating between sync threads and async tasks. For example from an async world of socket communication with Tokio to to the sync world of the NATS crate. I'm sure there are many other such cases.

Does Postage do anything to address that sync/async divide?

At the moment, the channels only work on async executors. But I think I could implement some kind of blocking send/recv at the Sink/Stream trait level. I'd just need a way to suspend a thread until a Waker is called.

The Tokio mpsc channel's blocking send and receives just wrap the ordinary method in something equivalent to futures::executor::block_on. You could do the same, or look inside its impl (it uses park from std::thread)

2 Likes

Thanks! That should be straightforward to implement. I'll add it to the next release!

Hey @ZiCog,
I released v0.4.0 with blocking_send and blocking_recv support!

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.