10 unstable releases (3 breaking)
0.5.0 | Nov 6, 2023 |
---|---|
0.4.4 | Mar 7, 2023 |
0.3.0 |
|
0.2.0 | Mar 3, 2023 |
0.1.2 | Mar 2, 2023 |
#2828 in Rust patterns
25 downloads per month
14KB
305 lines
Flatten
and FlatMap
with constant inner iterator size
This Rust package provides ConstSizeFlatten
and ConstSizeFlatMap
which make use of the also provided ConstSizeIntoIterator
to know how many items they will yield.
Note that core
& std
already provide this functionality for some types through a hack using specialization. This crate’s contribution is that the trait ConstSizeIntoIterator
is public and the functionality is therefore extensible.
lib.rs
:
Versions of FlatMap
and Flatten
that know their inner iterators’ size in advance.
Note that core
& std
already provide this functionality for some types through a hack using specialization.
This crate’s contribution is that the trait ConstSizeIntoIterator
is public and the functionality is therefore extensible.
To use, just use const_size_flatten::IteratorExtension
.