Use write_all instead of write_line
This commit is contained in:
parent
d328d6472e
commit
a41fd590a8
@ -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),
|
||||
/// }
|
||||
|
Loading…
x
Reference in New Issue
Block a user