Use write_all instead of write_line

This commit is contained in:
Carol Nichols 2015-06-03 13:23:20 -04:00
parent d328d6472e
commit a41fd590a8

View File

@ -130,14 +130,14 @@ macro_rules! println {
///
/// fn write_to_file_using_try() -> Result<(), io::Error> {
/// let mut file = try!(File::create("my_best_friends.txt"));
/// try!(file.write_line("This is a list of my best friends."));
/// try!(file.write_all(b"This is a list of my best friends."));
/// println!("I wrote to the file");
/// Ok()
/// }
/// // This is equivalent to:
/// fn write_to_file_using_match() -> Result<(), io::Error> {
/// let mut file = try!(File::create("my_best_friends.txt"));
/// match file.write_line("This is a list of my best friends.") {
/// match file.write_all(b"This is a list of my best friends.") {
/// Ok(_) => (),
/// Err(e) => return Err(e),
/// }