https://github.com/pykeio/async-stream-lite
Proc macro-free async/await Rust streams
https://github.com/pykeio/async-stream-lite
async-stream rust rust-async
Last synced: about 1 year ago
JSON representation
Proc macro-free async/await Rust streams
- Host: GitHub
- URL: https://github.com/pykeio/async-stream-lite
- Owner: pykeio
- License: other
- Created: 2024-11-16T07:12:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-04T06:35:55.000Z (over 1 year ago)
- Last Synced: 2025-05-11T07:09:43.934Z (about 1 year ago)
- Topics: async-stream, rust, rust-async
- Language: Rust
- Homepage: https://docs.rs/async-stream-lite
- Size: 23.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `async-stream-lite`
It's [`async-stream`](https://lib.rs/crates/async-stream), but without proc macros.
```rs
use async_stream_lite::async_stream;
use futures_util::{pin_mut, stream::StreamExt};
#[tokio::main]
async fn main() {
let stream = async_stream(|yielder| async move {
for i in 0..3 {
yielder.r#yield(i).await;
}
});
pin_mut!(stream);
while let Some(value) = stream.next().await {
println!("got {}", value);
}
}
```
## `#![no_std]` support
`async-stream-lite` supports `#![no_std]`, but requires `alloc`.