#tokio #stream #async #next #dropped #streammap #stream-map

streammap-ext

StreamMap of Tokio with altered next that returns when stream is dropped

1 unstable release

0.1.0 Jul 20, 2022

#903 in Asynchronous

Download history 422/week @ 2024-04-11 238/week @ 2024-04-18 288/week @ 2024-04-25 286/week @ 2024-05-02 371/week @ 2024-05-09 231/week @ 2024-05-16 397/week @ 2024-05-23 150/week @ 2024-05-30 558/week @ 2024-06-06 372/week @ 2024-06-13 328/week @ 2024-06-20 326/week @ 2024-06-27 205/week @ 2024-07-04 447/week @ 2024-07-11 357/week @ 2024-07-18 344/week @ 2024-07-25

1,415 downloads per month

MIT license

23KB
223 lines

streammap-ext

This is a fork of StreamMap from tokio-stream crate. The only difference between the implementations is that this version of StreamMap next returns Option<K,Option<V>> instead of Option<K,V>. This is to allow the developer to be aware when a stream is being dropped from the StreamMap, without the need to implement a Drop trait which can be troublesome in some cases (e.g. the drop flow requires async code).

After releasing this crate, I'll open a discussion to consider how to contribute it back to the original crate (as a different name, maybe a PhantomData that marks behavior, or maybe change the current behavior to this).

LICENSE

MIT - Same as source, all copy right goes to Tokio Contributors as this is a fork of tokio-stream crate.

Dependencies

~2.1–3MB
~49K SLoC