Collect all insertions keyed by the base index they follow.
(ops: &[EditOp])
| 302 | |
| 303 | /// Collect all insertions keyed by the base index they follow. |
| 304 | fn 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 |
no test coverage detected