We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f47fcc7 + 18b094b commit dcc8fa5Copy full SHA for dcc8fa5
src/libstd/io/util.rs
@@ -110,6 +110,16 @@ pub struct Repeat { byte: u8 }
110
///
111
/// All reads from this reader will succeed by filling the specified buffer with
112
/// the given byte.
113
+///
114
+/// # Examples
115
116
+/// ```
117
+/// use std::io::{self, Read};
118
119
+/// let mut buffer = [0; 3];
120
+/// io::repeat(0b101).read_exact(&mut buffer).unwrap();
121
+/// assert_eq!(buffer, [0b101, 0b101, 0b101]);
122
123
#[stable(feature = "rust1", since = "1.0.0")]
124
pub fn repeat(byte: u8) -> Repeat { Repeat { byte: byte } }
125
0 commit comments