diff options
| author | Corey Farwell <coreyf@rwell.org> | 2016-06-28 08:22:34 -0400 |
|---|---|---|
| committer | Corey Farwell <coreyf@rwell.org> | 2016-06-28 08:22:44 -0400 |
| commit | 325e09e952264ad5b1bccbeb5774446f3c601957 (patch) | |
| tree | d3ad30b3a79f805794af9267823c7cc8d2e5ae2e | |
| parent | a0f572e98bacc719aa211b1fe97c61339cf6c93a (diff) | |
| download | rust-325e09e952264ad5b1bccbeb5774446f3c601957.tar.gz rust-325e09e952264ad5b1bccbeb5774446f3c601957.zip | |
Add doc example for `std::io::sink`.
| -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 2815c0163d6..e5d6cb2b34e 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -139,6 +139,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: () } } |
