11 releases

0.3.0 Oct 31, 2024
0.2.1 Aug 11, 2024
0.2.0 Jul 1, 2024
0.1.3 Mar 31, 2024
0.1.0 Dec 4, 2023

#594 in Asynchronous

Download history 1/week @ 2024-07-23 173/week @ 2024-08-06 35/week @ 2024-08-13 148/week @ 2024-08-27 22/week @ 2024-09-03 36/week @ 2024-09-10 17/week @ 2024-09-17 23/week @ 2024-09-24 6/week @ 2024-10-01 1/week @ 2024-10-08 134/week @ 2024-10-29 7/week @ 2024-11-05

141 downloads per month

MIT license

15KB
324 lines

Crate Info

Multiple Readers

multiple-readers is a Rust library aimed at simplifying the process of combining multiple types that implement the std::io::Read trait into a unified reader.

Features

  • Combines multiple types that implement the std::io::Read trait into a unified reader.
  • Can read from data sources sequentially until all data sources are exhausted.
  • Supports tokio ( Unstable )

Example

use multi_readers::join_readers;
use std::io::{Cursor, Read};
fn main() -> std::io::Result<()> {

    let slice = Cursor::new(b"First-");
    let bytes = Cursor::new(b"Second-");
    let mut reader = join_readers!(slice, bytes);
    let mut buf = String::new();
    reader.read_to_string(&mut buf)?;
    assert_eq!(buf.as_str(), "First-Second-");
    Ok(())
}

Dependencies

~0–5.5MB
~19K SLoC