Expand description
A non-owning version of std::io::Take that wraps an existing reader by reference,
allowing limited reads without transferring ownership.
§Example
use std::io::{Cursor, Read};
use reftake::RefTakeExt;
let mut cursor = Cursor::new(b"hello world");
let mut take = cursor.take_ref(5);
let mut buf = String::new();
take.read_to_string(&mut buf).unwrap();
assert_eq!(buf, "hello");
let mut buf2 = String::new();
cursor.read_to_string(&mut buf2).unwrap();
assert_eq!(buf2, " world");Structs§
- RefTake
- A non-owning adapter that wraps a mutable reference to a reader, limiting the number of bytes that can be read from it.
Traits§
- RefTake
Ext - Extension trait to provide a
take_refmethod on allReadtypes.