Iterator::size_hint helps consumers by providing some hint of the iterator's size. This benefits patterns like collecting an iterator into a vec (iter.collect::<Vec<_>>()) because the collection can reserve the correct space, without requiring re-allocations.
BNF's iterators currently hold slices internally, so the size_hint should be quite simple to implement (iterator impl search link)
There are 3 (or 4 once #92 is merged) Iterators to update:
Iterator::size_hint helps consumers by providing some hint of the iterator's size. This benefits patterns like collecting an iterator into a vec (
iter.collect::<Vec<_>>()
) because the collection can reserve the correct space, without requiring re-allocations.BNF's iterators currently hold
slice
s internally, so thesize_hint
should be quite simple to implement (iterator impl search link)There are 3 (or 4 once #92 is merged) Iterators to update: