1 unstable release

0.1.4 Nov 13, 2020
0.1.3 Nov 13, 2020
0.1.2 Sep 10, 2020
0.1.1 Sep 10, 2020
0.1.0 Sep 10, 2020

#421 in Asynchronous

Download history 18/week @ 2020-10-31 86/week @ 2020-11-07 63/week @ 2020-11-14 17/week @ 2020-11-21 22/week @ 2020-11-28 35/week @ 2020-12-05 12/week @ 2020-12-12 12/week @ 2020-12-19 203/week @ 2021-01-02 314/week @ 2021-01-09 134/week @ 2021-01-16 228/week @ 2021-01-23 103/week @ 2021-01-30 95/week @ 2021-02-06 116/week @ 2021-02-13

89 downloads per month

Apache-2.0

10KB
83 lines

catty

a picture of a slingshot

Send a value synchronously and asynchronously wait for it. Catty is faster, simpler, and more lightweight than futures::oneshot, which is slightly more flexible.

Example

let (tx, rx) = catty::oneshot();
tx.send("Hello!");
assert_eq!(rx.await, Ok("Hello!"));

Benchmarks

To run the benchmarks with Criterion, simply do cargo bench. On my machine, the results are as follows:

create-futures          time:   [105.43 ns 105.52 ns 105.61 ns]
create-catty            time:   [47.774 ns 47.808 ns 47.843 ns]
oneshot-futures         time:   [195.77 ns 195.88 ns 196.01 ns]
oneshot-catty           time:   [134.70 ns 134.80 ns 134.91 ns]

lib.rs:

Send a value and asynchronously wait for it.

Example

# pollster::block_on(async {
let (tx, rx) = catty::oneshot();
tx.send("Hello!");
assert_eq!(rx.await, Ok("Hello!"));
# })

Dependencies

~99KB