Crates.io | rc-u8-reader |
lib.rs | rc-u8-reader |
version | 2.0.16 |
source | src |
created_at | 2019-05-26 05:17:48.488582 |
updated_at | 2022-11-03 03:27:09.136002 |
description | A tiny implement for reading `u8` data from a reference counted instance. |
homepage | https://magiclen.org/rc-u8-reader |
repository | https://github.com/magiclen/rc-u8-reader |
max_upload_size | |
id | 137076 |
size | 18,955 |
A tiny implement for reading u8
data from a reference counted instance.
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);
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);
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);
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);
https://crates.io/crates/rc-u8-reader