async-stream-lite

Crates.ioasync-stream-lite
lib.rsasync-stream-lite
version0.2.0
created_at2024-11-16 22:18:21.111738+00
updated_at2024-12-04 06:35:26.485397+00
descriptionProc macro-free async/await Rust streams
homepage
repositoryhttps://github.com/pykeio/async-stream-lite
max_upload_size
id1450710
size24,707
(decahedron1)

documentation

README

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.

Commit count: 12

cargo fmt