#reference-counting #u8 #read #rc #arc #io-read #in-memory

rc-u8-reader

A tiny implement for reading u8 data from a reference counted instance

17 stable releases

2.0.16 Nov 3, 2022
2.0.15 Mar 18, 2022
2.0.14 Apr 26, 2021
2.0.12 Jul 29, 2020
1.0.1 May 26, 2019

#234 in Data structures

Download history 93/week @ 2024-07-19 97/week @ 2024-07-26 55/week @ 2024-08-02 78/week @ 2024-08-09 47/week @ 2024-08-16 56/week @ 2024-08-23 107/week @ 2024-08-30 62/week @ 2024-09-06 47/week @ 2024-09-13 110/week @ 2024-09-20 88/week @ 2024-09-27 37/week @ 2024-10-04 49/week @ 2024-10-11 37/week @ 2024-10-18 32/week @ 2024-10-25 54/week @ 2024-11-01

173 downloads per month
Used in 10 crates (3 directly)

MIT license

18KB
405 lines

Rc U8 Reader

CI

A tiny implement for reading u8 data from a reference counted instance.

Examples

RcU8Reader

use std::rc::Rc;
use std::io::Read;

use rc_u8_reader::RcU8Reader;

let data = b"Hello world!".to_vec();

let mut reader = RcU8Reader::new(Rc::new(data));

let mut result = String::new();

reader.read_to_string(&mut result).unwrap();

assert_eq!("Hello world!".to_string(), result);

RcRefCellU8Reader

use std::cell::RefCell;
use std::rc::Rc;
use std::io::Read;

use rc_u8_reader::RcRefCellU8Reader;

let data = b"Hello world!".to_vec();

let mut reader = RcRefCellU8Reader::new(Rc::new(RefCell::new(data)));

let mut result = String::new();

reader.read_to_string(&mut result).unwrap();

assert_eq!("Hello world!".to_string(), result);

ArcU8Reader

use std::sync::Arc;
use std::io::Read;

use rc_u8_reader::ArcU8Reader;

let data = b"Hello world!".to_vec();

let mut reader = ArcU8Reader::new(Arc::new(data));

let mut result = String::new();

reader.read_to_string(&mut result).unwrap();

assert_eq!("Hello world!".to_string(), result);

ArcMutexU8Reader

use std::sync::{Arc, Mutex};
use std::io::Read;

use rc_u8_reader::ArcMutexU8Reader;

let data = b"Hello world!".to_vec();

let mut reader = ArcMutexU8Reader::new(Arc::new(Mutex::new(data)));

let mut result = String::new();

reader.read_to_string(&mut result).unwrap();

assert_eq!("Hello world!".to_string(), result);

Crates.io

https://crates.io/crates/rc-u8-reader

Documentation

https://docs.rs/rc-u8-reader

License

MIT

Dependencies

~0–5.5MB
~19K SLoC