MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / insert_positions

Function insert_positions

atomic-core/src/merge/three_way.rs:304–312  ·  view source on GitHub ↗

Collect all insertions keyed by the base index they follow.

(ops: &[EditOp])

Source from the content-addressed store, hash-verified

302
303/// Collect all insertions keyed by the base index they follow.
304fn insert_positions(ops: &[EditOp]) -> HashMap<usize, Vec<Vec<u8>>> {
305 let mut map: HashMap<usize, Vec<Vec<u8>>> = HashMap::new();
306 for op in ops {
307 if let EditOp::Insert(after, content) = op {
308 map.entry(*after).or_default().push(content.clone());
309 }
310 }
311 map
312}
313
314// ---------------------------------------------------------------------------
315// Merge application

Callers 2

three_way_mergeFunction · 0.85
merge_opsFunction · 0.85

Calls 2

pushMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected