2 unstable releases

0.2.0 Dec 4, 2024
0.1.0 Nov 16, 2024

#823 in Asynchronous

Download history 90/week @ 2024-11-11 39/week @ 2024-11-18 122/week @ 2024-12-02 7/week @ 2024-12-09

211 downloads per month
Used in azure-cognitive-speech-se…

MIT license

20KB
521 lines

async-stream-lite

It's async-stream, but without proc macros.

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.

Dependencies

~71KB