diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-04-06 10:51:26 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-04-06 10:51:26 +0300 |
commit | 8d968f547c171af8a15f670b4c7b517ef54d27d9 (patch) | |
tree | ef09ebe7a07ab44d9b5b45e8e5ace79c43f82042 /src/main.rs | |
parent | c8e4c602785dd3b532b1006674d0b15063901c20 (diff) | |
download | checksum-concurrency-8d968f547c171af8a15f670b4c7b517ef54d27d9.tar.gz |
add Blobs iterator
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index e7a11a9..b37873b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,24 @@ fn main() { - println!("Hello, world!"); + let blobs = Blobs::new(128 * 1024); + for blob in blobs.take(10) { + println!("{}", blob.len()); + } +} + +struct Blobs { + size: usize, +} + +impl Blobs { + fn new(size: usize) -> Self { + Self { size } + } +} + +impl Iterator for Blobs { + type Item = Vec<u8>; + + fn next(&mut self) -> Option<Self::Item> { + Some(vec![0; self.size]) + } } |