diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2016-06-28 16:05:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-06-28 16:05:16 +0200 |
| commit | dd56a6ad0845b76509c4f8967e8ca476471ab7e0 (patch) | |
| tree | 451a1988dffa6bfa09c0a2d7b84f78ef44125f15 | |
| parent | dcc8fa52705a2267012cdba7c90662d472ce8d2c (diff) | |
| parent | 325e09e952264ad5b1bccbeb5774446f3c601957 (diff) | |
| download | rust-dd56a6ad0845b76509c4f8967e8ca476471ab7e0.tar.gz rust-dd56a6ad0845b76509c4f8967e8ca476471ab7e0.zip | |
Rollup merge of #34524 - frewsxcv:std-io-sink, r=GuillaumeGomez
Add doc example for `std::io::sink`. None
| -rw-r--r-- | src/libstd/io/util.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 7df2db9ee65..07f43f72ff5 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -146,6 +146,16 @@ pub struct Sink { _priv: () } /// /// All calls to `write` on the returned instance will return `Ok(buf.len())` /// and the contents of the buffer will not be inspected. +/// +/// # Examples +/// +/// ```rust +/// use std::io::{self, Write}; +/// +/// let mut buffer = vec![1, 2, 3, 5, 8]; +/// let num_bytes = io::sink().write(&mut buffer).unwrap(); +/// assert_eq!(num_bytes, 5); +/// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn sink() -> Sink { Sink { _priv: () } } |
