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.
std::io::repeat
1 parent a0f572e commit 18b094bCopy full SHA for 18b094b
src/libstd/io/util.rs
@@ -113,6 +113,16 @@ pub struct Repeat { byte: u8 }
113
///
114
/// All reads from this reader will succeed by filling the specified buffer with
115
/// the given byte.
116
+///
117
+/// # Examples
118
119
+/// ```
120
+/// use std::io::{self, Read};
121
122
+/// let mut buffer = [0; 3];
123
+/// io::repeat(0b101).read_exact(&mut buffer).unwrap();
124
+/// assert_eq!(buffer, [0b101, 0b101, 0b101]);
125
126
#[stable(feature = "rust1", since = "1.0.0")]
127
pub fn repeat(byte: u8) -> Repeat { Repeat { byte: byte } }
128
0 commit comments