-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Description
#![feature(io)]
use std::io::{BufRead};
fn main() {
let buf = &[][];
let mut reader = std::old_io::BufReader::new(buf);
println!("{:?}", reader.read_line());
let mut reader = std::io::BufReader::new(buf);
let mut dummy = String::new();
println!("{:?}", reader.read_line(&mut dummy));
}
Err(IoError { kind: EndOfFile, desc: "end of file", detail: None })
Ok(())
The read_until and read_line methods are changed to take explicit, mutable buffers, for similar reasons to read_to_end. (Note that buffer reuse is particularly common for read_line). These functions include the delimiters in the strings they produce, both for easy cross-platform compatibility (in the case of read_line) and for ease in copying data without loss (in particular, distinguishing whether the last line included a final delimiter).
In particular: No changes to the error semantics were mentioned in the RFC.
Metadata
Metadata
Assignees
Labels
No labels