Skip to content

Commit

Permalink
Add doc example for std::io::sink.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Jun 28, 2016
1 parent a0f572e commit 325e09e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libstd/io/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: () } }

Expand Down

0 comments on commit 325e09e

Please sign in to comment.