File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1418,6 +1418,27 @@ pub trait Write {
1418
1418
/// The default implementation calls [`write`] with either the first nonempty
1419
1419
/// buffer provided, or an empty one if none exists.
1420
1420
///
1421
+ /// # Examples
1422
+ ///
1423
+ /// ```no_run
1424
+ /// use std::io::IoSlice;
1425
+ /// use std::io::prelude::*;
1426
+ /// use std::fs::File;
1427
+ ///
1428
+ /// fn main() -> std::io::Result<()> {
1429
+ /// let mut data1 = [1; 8];
1430
+ /// let mut data2 = [15; 8];
1431
+ /// let io_slice1 = IoSlice::new(&mut data1);
1432
+ /// let io_slice2 = IoSlice::new(&mut data2);
1433
+ ///
1434
+ /// let mut buffer = File::create("foo.txt")?;
1435
+ ///
1436
+ /// // Writes some prefix of the byte string, not necessarily all of it.
1437
+ /// buffer.write_vectored(&[io_slice1, io_slice2])?;
1438
+ /// Ok(())
1439
+ /// }
1440
+ /// ```
1441
+ ///
1421
1442
/// [`write`]: Write::write
1422
1443
#[ stable( feature = "iovec" , since = "1.36.0" ) ]
1423
1444
fn write_vectored ( & mut self , bufs : & [ IoSlice < ' _ > ] ) -> Result < usize > {
You can’t perform that action at this time.
0 commit comments