#future #oneshot #tor #arti #channel #fused #receiver

oneshot-fused-workaround

Fused wrapper for futures::channel::oneshot

3 unstable releases

new 0.2.1 Jan 7, 2025
0.2.0 Sep 30, 2024
0.1.0 Sep 3, 2024

#2200 in Rust patterns

Download history 308/week @ 2024-09-20 1153/week @ 2024-09-27 583/week @ 2024-10-04 519/week @ 2024-10-11 480/week @ 2024-10-18 602/week @ 2024-10-25 1513/week @ 2024-11-01 638/week @ 2024-11-08 1504/week @ 2024-11-15 1017/week @ 2024-11-22 1816/week @ 2024-11-29 1771/week @ 2024-12-06 1590/week @ 2024-12-13 853/week @ 2024-12-20 776/week @ 2024-12-27 835/week @ 2025-01-03

4,353 downloads per month
Used in 52 crates (13 directly)

MIT/Apache

6KB
54 lines

oneshot-fused-workaround

Thin veneer over futures::channel::oneshot to fix use with futures::select!. See futures-rs ticket #2455.

License: MIT OR Apache-2.0


lib.rs:

Thin veneer over futures::channel::oneshot to fix use with select!

A bare futures::channel::oneshot::Receiver doesn't work properly with futures::select!, because it has a broken FusedFuture implementation. (See futures-rs ticket #2455.)

Wrapping it up in a future::Fuse works around this, with a minor performance penalty.

Limitations

The API of this Receiver is rather more limited. For example, it lacks .try_recv().

Dependencies

~0.6–0.8MB
~15K SLoC