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

Function build_action_map

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

Build a map from base index → action for modifications only (not keeps).

(ops: &[EditOp])

Source from the content-addressed store, hash-verified

371
372/// Build a map from base index → action for modifications only (not keeps).
373fn build_action_map(ops: &[EditOp]) -> HashMap<usize, Action> {
374 let mut map = HashMap::new();
375 for op in ops {
376 match op {
377 EditOp::Replace(idx, content) => {
378 map.insert(*idx, Action::Replace(content.clone()));
379 }
380 EditOp::Delete(idx) => {
381 map.insert(*idx, Action::Delete);
382 }
383 _ => {}
384 }
385 }
386 map
387}
388
389/// Emit the result of an action (replace or delete) on a base token.
390fn emit_action(action: &Action, _base_token: &MergeToken, result: &mut Vec<u8>) {

Callers 1

merge_opsFunction · 0.85

Calls 2

insertMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected