read_collection

Crates.ioread_collection
lib.rsread_collection
version0.0.2
sourcesrc
created_at2024-06-12 18:07:50.59832
updated_at2024-06-12 18:14:24.706236
descriptionA collection of different variants of the `std::io::Read` trait.
homepagehttps://github.com/TornaxO7/ReadCollection
repositoryhttps://github.com/TornaxO7/ReadCollection
max_upload_size
id1269838
size101,247
TornaxO7 (TornaxO7)

documentation

README

Read Collection

This crate provides some other variants of the Read trait, like ReadBack or RevRead.

Example (ReadBack)

use read_collection::ReadBack;
use std::io::Read;

fn main() {
    let values = [1, 2, 3];
    let mut buffer = [0];

    // How it could look like with `Read`:
    assert_eq!(values.as_slice().read(&mut buffer).ok(), Some(1));
    assert_eq!(buffer, [1]);

    // With `ReadBack`:
    assert_eq!(values.as_slice().read_back(&mut buffer).ok(), Some(1));
    //                 [-] and the buffer contains the value starting from the back!
    assert_eq!(buffer, [3]);
}

Status

Implemented:

  • ReadBack for reading back duh
    • ReadBack trait
    • BufReadBack trait
      • for &[u8]
      • for Empty
      • BufReadBacker struct
  • RevRead for reading reversed
    • RevRead trait
    • BufRevRead trait
      • for &[u8]
      • for Empty
      • BufRevReader struct
Commit count: 83

cargo fmt