summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: b37873b685f14cbe757decf3e9b72c65a56da17f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
fn main() {
    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])
    }
}