forked from mirrors/jj
01ac97f999
Implementing `Iterator` and `FromIterator` on `Merge<T>` provides much more flexibility than the current `map()`, `try_map()`, etc. `Merge::from_iter()` wouldn't have a way of failing if it's given an unexpected (even) number of items. I would be fine with having it panic, but we can't even usefully do that, because e.g. `Option::from_iter()` will pass us an iterator ends early if the input interator ends early. For example, `Merge::resolved(None).iter().collect()` would call `Merge::from_iter()` with an empty iterator (first item `None`). So, I instead created a `MergeBuilder` type implementing `FromIterator`, and let `MergeBuilder::build()` panic if there were an even number of items. I re-implemented some existing `Merge` methods using the new facilities in this commit. Maybe we should remove some of the methods. |
||
---|---|---|
.. | ||
benches | ||
gen-protos | ||
src | ||
tests | ||
testutils | ||
Cargo.toml |