std: Add .consume_iter() for Option, to make it reusable

Let Option be a base for a widely useful one- or zero- item iterator.
Refactor OptionIterator to support any generic element type, so the same
iterator impl can be used for both &T, &mut T and T iterators.
std: Convert Result to use external iterators

convert iter() and iter_err() for Result. Use OptionIterator.
std: Remove unused trait bound in Result::map
std: Implement RandomAccessIterator for Invert
std: Improve vec::ChunkIter

Implement clone, bidirectionality and random access for this iterator
std: Add iterator::Repeat to repeat an element endlessly
std: Rewrite the HashSet set operation iterators

Use the Repeat iterator to carry the "explicit closure capture" that was
previously done with the custom EnvFilterIterator.
std: Use method name Option::consume

With Option as the simplest container, `consume` is the way to turn it
into a by-value iterator.
std: Improve the documentation for iterator::Invert
extra: Simplify the bitv iterators using Repeat
std: Remove uint::iterate, replaced by `range`
std: Fix bug in ChunkIter::idx

ChunkIter .idx() didn't handle overflow correctly, even though it tried.
auto merge of #8265 : blake2-ppc/rust/std-iter, r=thestinger

Fix #8228 by replacing .iter() and .iter_err() in Result by external iterators.

Implement random access for `iterator::Invert` and `vec::ChunkIter` (and bidirectionality).

Implement Repeat iterator.