Sunbeam Studios

Our open-source projects, here for you!

want (0.3.1)

Published 2026-03-26 11:05:09 +00:00 by siennathesane

Installation

[registry]
default = "gitea"

[registries.gitea]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add want@0.3.1

About this package

Detect when another Future wants a result.

Want

A Futures channel-like utility to signal when a value is wanted.

Futures are supposed to be lazy, and only starting work if Future::poll is called. The same is true of Streams, but when using a channel as a Stream, it can be hard to know if the receiver is ready for the next value.

Put another way, given a (tx, rx) from futures::sync::mpsc::channel(), how can the sender (tx) know when the receiver (rx) actually wants more work to be produced? Just because there is room in the channel buffer doesn't mean the work would be used by the receiver.

This is where something like want comes in. Added to a channel, you can make sure that the tx only creates the message and sends it when the rx has poll() for it, and the buffer was empty.

License

want is provided under the MIT license. See LICENSE.

Dependencies

ID Version
try-lock ^0.2.4
tokio-executor ^0.2.0-alpha.2
tokio-sync ^0.2.0-alpha.2

Keywords

futures channel async
Details
Cargo
2026-03-26 11:05:09 +00:00
0
Sean McArthur <sean@seanmonstar.com>
MIT
7.0 KiB
Assets (1)
Versions (1) View all
0.3.1 2026-03-26