Function repeat
pub fn repeat(byte: u8) -> Repeat
Expand description
Creates an infinite reader that reads the same byte repeatedly.
ยงExamples
use futures_lite::io::{self, AsyncReadExt};
let mut reader = io::repeat(b'a');
let mut contents = vec![0; 5];
reader.read_exact(&mut contents).await?;
assert_eq!(contents, b"aaaaa");