openharmony_ci 944a2a95cc !2 README.OpenSource 中License信息整改
Merge pull request !2 from peizhe/master
2023-05-05 02:26:29 +00:00
2019-02-20 11:57:47 -08:00
2019-08-20 11:59:30 -07:00
2018-03-15 15:26:45 -07:00
2019-08-20 11:59:30 -07:00
2019-03-19 12:44:42 -07:00
2019-03-19 12:44:42 -07:00

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.

S
Description
一个 Futures channel-like 工具通知一个值被需要
Readme MIT 76 KiB
Languages
Rust 100%