Skip to content

Commit 8dbae79

Browse files
committed
Use write_all instead of write in example code
1 parent 237bf32 commit 8dbae79

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/libstd/io/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ pub trait Write {
11511151
/// fn main() -> std::io::Result<()> {
11521152
/// let mut buffer = BufWriter::new(File::create("foo.txt")?);
11531153
///
1154-
/// buffer.write(b"some bytes")?;
1154+
/// buffer.write_all(b"some bytes")?;
11551155
/// buffer.flush()?;
11561156
/// Ok(())
11571157
/// }

src/libstd/io/stdio.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ pub struct StdoutLock<'a> {
405405
/// use std::io::{self, Write};
406406
///
407407
/// fn main() -> io::Result<()> {
408-
/// io::stdout().write(b"hello world")?;
408+
/// io::stdout().write_all(b"hello world")?;
409409
///
410410
/// Ok(())
411411
/// }
@@ -420,7 +420,7 @@ pub struct StdoutLock<'a> {
420420
/// let stdout = io::stdout();
421421
/// let mut handle = stdout.lock();
422422
///
423-
/// handle.write(b"hello world")?;
423+
/// handle.write_all(b"hello world")?;
424424
///
425425
/// Ok(())
426426
/// }
@@ -460,7 +460,7 @@ impl Stdout {
460460
/// let stdout = io::stdout();
461461
/// let mut handle = stdout.lock();
462462
///
463-
/// handle.write(b"hello world")?;
463+
/// handle.write_all(b"hello world")?;
464464
///
465465
/// Ok(())
466466
/// }
@@ -558,7 +558,7 @@ pub struct StderrLock<'a> {
558558
/// use std::io::{self, Write};
559559
///
560560
/// fn main() -> io::Result<()> {
561-
/// io::stderr().write(b"hello world")?;
561+
/// io::stderr().write_all(b"hello world")?;
562562
///
563563
/// Ok(())
564564
/// }
@@ -573,7 +573,7 @@ pub struct StderrLock<'a> {
573573
/// let stderr = io::stderr();
574574
/// let mut handle = stderr.lock();
575575
///
576-
/// handle.write(b"hello world")?;
576+
/// handle.write_all(b"hello world")?;
577577
///
578578
/// Ok(())
579579
/// }
@@ -613,7 +613,7 @@ impl Stderr {
613613
/// let stderr = io::stderr();
614614
/// let mut handle = stderr.lock();
615615
///
616-
/// handle.write(b"hello world")?;
616+
/// handle.write_all(b"hello world")?;
617617
///
618618
/// Ok(())
619619
/// }

0 commit comments

Comments
 (0)