Go to file
John Nunley e243d55a45
v2.1.1
Signed-off-by: John Nunley <dev@notgull.net>
2023-11-24 07:50:47 -08:00
.github Add explicit web support (#67) 2023-09-16 21:11:25 -07:00
src m: Bump to event-listener v4.0.0 2023-11-21 06:10:49 -08:00
tests Add explicit web support (#67) 2023-09-16 21:11:25 -07:00
.gitignore Initial commit 2020-05-31 02:00:16 +02:00
CHANGELOG.md v2.1.1 2023-11-24 07:50:47 -08:00
Cargo.toml v2.1.1 2023-11-24 07:50:47 -08:00
LICENSE-APACHE Initial commit 2020-05-31 02:00:16 +02:00
LICENSE-MIT Initial commit 2020-05-31 02:00:16 +02:00
README.md added in docs main work principle of channel 2021-03-07 19:39:42 +07:00

README.md

async-channel

Build License Cargo Documentation

An async multi-producer multi-consumer channel, where each message can be received by only one of all existing consumers.

There are two kinds of channels:

  1. Bounded channel with limited capacity.
  2. Unbounded channel with unlimited capacity.

A channel has the Sender and Receiver side. Both sides are cloneable and can be shared among multiple threads.

When all Senders or all Receivers are dropped, the channel becomes closed. When a channel is closed, no more messages can be sent, but remaining messages can still be received.

The channel can also be closed manually by calling Sender::close() or Receiver::close().

Examples

let (s, r) = async_channel::unbounded();

assert_eq!(s.send("Hello").await, Ok(()));
assert_eq!(r.recv().await, Ok("Hello"));

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.