This patch adds an implementation of the Iterator::size_hint() trait function so that the compiler can optimize allocations on the collecting side of the iterator better. From the trait function docs: > size_hint() is primarily intended to be used for optimizations such > as reserving space for the elements of the iterator, but must not be > trusted to e.g., omit bounds checks in unsafe code. An incorrect > implementation of size_hint() should not lead to memory safety > violations. Source: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.size_hint And: > Vec may use any or none of the following strategies, depending on the > supplied iterator: > > * preallocate based on Iterator::size_hint() and panic if the number > of items is outside the provided lower/upper bounds Source: https://doc.rust-lang.org/stable/std/iter/trait.FromIterator.html Signed-off-by: Matthias Beyer <mail@beyermatthias.de> |
||
|---|---|---|
| .. | ||
| cache | ||
| issue | ||
| patch | ||
| cache.rs | ||
| common.rs | ||
| external.rs | ||
| identity.rs | ||
| issue.rs | ||
| op.rs | ||
| patch.rs | ||
| store.rs | ||
| test.rs | ||
| thread.rs | ||