Convert a SemanticDiff to FileOps. # Arguments `diff` - The semantic diff to convert `path` - The file path # Returns A `FileOps` containing all the CRDT operations for this diff.
(
&mut self,
diff: &SemanticDiff<'a>,
path: &str,
)
| 324 | /// |
| 325 | /// A `FileOps` containing all the CRDT operations for this diff. |
| 326 | pub fn convert_diff<'a>( |
| 327 | &mut self, |
| 328 | diff: &SemanticDiff<'a>, |
| 329 | path: &str, |
| 330 | ) -> ConversionResult<FileOps> { |
| 331 | let mut file_ops = FileOps::edit(self.trunk_id, path.to_string()); |
| 332 | |
| 333 | for change in diff.changes() { |
| 334 | let line_ops = self.convert_line_change(change)?; |
| 335 | for op in line_ops { |
| 336 | file_ops.add_line_op(op); |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | Ok(file_ops) |
| 341 | } |
| 342 | |
| 343 | /// Convert a single LineChange to LineOps. |
| 344 | fn convert_line_change<'a>( |