1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Do you have callbacks (and other difficult for iterators) and are you tired of `.collect()` them into `Vecs`? There is a
solution.
`Buter` - buffered iterator with fluid buffer, which is used as a place for all iterations
```rust
fn callback_work<F>(mut f: F)
where
{
}
use buter::Buter;
struct Worker {
}
impl Worker {
}
```
This is appropriate both with large results and with small ones
```rust
// buter bench: 14 ns/iter (+/- 5)
// vec_push bench: 212 ns/iter (+/- 130)
// vec_push_with_capacity bench: 54 ns/iter (+/- 32)
```
```rust
// buter time: [1.6348 ms 1.6445 ms 1.6549 ms]
// vec_push time: [4.4204 ms 4.4750 ms 4.5360 ms]
// vec_push_with_capacity time: [2.6034 ms 2.6338 ms 2.6680 ms]
```