ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/lib
Martin von Zweigbergk 01ac97f999 merge: implement Iterator and FromIterator
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.
2023-08-14 08:44:38 -07:00
..
benches cargo: rename crates from jujutsu/jujutsu-lib to jj-cli/jj-lib 2023-07-09 06:40:43 +02:00
gen-protos cargo: unify a lot of crate metadata in the workspace 2023-08-06 16:44:33 -05:00
src merge: implement Iterator and FromIterator 2023-08-14 08:44:38 -07:00
tests conflicts: remove redundant num_removes argument from parse_conflict() 2023-08-13 09:54:16 +00:00
testutils tests: move commit_transactions() helper to testutils 2023-08-10 06:27:16 +09:00
Cargo.toml cargo: unify a lot of crate metadata in the workspace 2023-08-06 16:44:33 -05:00