Skip to content

Commit

Permalink
Rollup merge of #34524 - frewsxcv:std-io-sink, r=GuillaumeGomez
Browse files Browse the repository at this point in the history
Add doc example for `std::io::sink`.

None
  • Loading branch information
GuillaumeGomez committed Jun 28, 2016
2 parents dcc8fa5 + 325e09e commit dd56a6a
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 @@ -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: () } }

Expand Down

0 comments on commit dd56a6a

Please sign in to comment.