asynk-strim
Like async-stream but without macros. Like async-fn-stream but a little more efficient.
Features:
- macroless API
- one dependency (besides
futures-corewhich I don't count since it provides theStreamdefinition) no_std-compatible, zero allocations
⚠ Important
This crate adds a wrapper around the wakers that contains data and pointers needed to yield items.
Crates like embassy use a similar approach and will therefore clash with us.
If you run into this issue (which will manifest as a runtime panic), you can use the unwrap_waker function.
This function will wrap a future and remove the waker wrapper.
While you can't use the yielder inside the unwrapped future, stuff like embassy should work again.
Example
use stream;
use pin;
let stream = pin!;
let mut stream = block_on;
assert_eq!;
assert_eq!;
assert_eq!;
Comparisons
async-stream
In comparison to async-stream we offer the following advantages:
- no macros
- slightly faster performance
no_stdsupport
async-fn-stream
In comparison to async-stream we offer the following advantages:
- no allocations
- slightly faster performance
no_stdsupport
Acknowledgements
This crate combines approaches from the following crates:
async-streamasync-fn-stream- The PR by Sabrina Jewson adding a function-based API to
async-stream - The experimental PR by Hyeonu Park using the waker-based approach
License
Licensed under tither the MIT or Apache 2.0 license (at your choosing)