#Extensions for Rusts standard Read
trait
This adds read_into_string
and read_into_vec
as specified in this RFC.
##How to use
extern crate readext;
use std::io::{Cursor};
use readext::ReadExt;
#[test]
fn can_read_into_string () {
let bytes = b"hello";
let mut input = Cursor::new(bytes as &[u8]);
let s = input.read_into_string().unwrap();
assert_eq!(s, "hello");
}
#[test]
fn can_read_into_vec () {
let bytes = b"hello";
let mut input = Cursor::new(bytes as &[u8]);
let s = input.read_into_vec().unwrap();
assert_eq!(s.len(), 5);
}