#async-stream #async #transform

transform-stream

Lightweight async stream wrapper

6 releases

0.3.1 Jan 18, 2025
0.3.0 Feb 1, 2023
0.2.0 Oct 13, 2021
0.1.2 Oct 22, 2020

#395 in Asynchronous

Download history 1691/week @ 2024-10-26 1158/week @ 2024-11-02 837/week @ 2024-11-09 1356/week @ 2024-11-16 955/week @ 2024-11-23 1302/week @ 2024-11-30 573/week @ 2024-12-07 878/week @ 2024-12-14 176/week @ 2024-12-21 741/week @ 2024-12-28 1534/week @ 2025-01-04 1119/week @ 2025-01-11 1577/week @ 2025-01-18 1213/week @ 2025-01-25 1419/week @ 2025-02-01 1062/week @ 2025-02-08

5,517 downloads per month
Used in 12 crates (4 directly)

MIT license

11KB
280 lines

transform-stream

Latest Version Documentation License

Lightweight async stream wrapper

Documentation: https://docs.rs/transform-stream

Inspired by https://github.com/tokio-rs/async-stream

Contributing


lib.rs:

Lightweight async stream wrapper.

Inspired by https://github.com/tokio-rs/async-stream

Usage

use transform_stream::{try_stream, AsyncTryStream};
use futures_util::{pin_mut, StreamExt};
use std::io;

let stream: AsyncTryStream<Vec<u8>, io::Error, _> = try_stream!{
    yield_!(vec![b'1', b'2']);
    yield_!(vec![b'3', b'4']);
    Ok(())
};

futures_executor::block_on(async {
    pin_mut!(stream);
    assert_eq!(stream.next().await.unwrap().unwrap(), vec![b'1', b'2']);
    assert_eq!(stream.next().await.unwrap().unwrap(), vec![b'3', b'4']);
    assert!(stream.next().await.is_none());
});

Dependencies

~25KB

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy