Similar::DiffOp
Abstract base class for diff operations.
Instance methods
as_tag_tuple
Transform the op into a tuple of diff tag and ranges.
This is useful when operating on slices. The returned format is
(tag, i1..i2, j1..j2):
Replace:a[i1..i2]should be replaced byb[j1..j2]Delete:a[i1..i2]should be deleted (j1 == j2in this case).Insert:b[j1..j2]should be inserted ata[i1..i2](i1 == i2in this case).Equal:a[i1..i2]is equal tob[j1..j2].
iter_changes(old, new)
Returns an iterator over the changes this operation expands to.
This method is a convenient way to automatically resolve the different ways in which a change could be encoded (insert/delete vs replace), look up the value from the appropriate slice and also handle correct index handling.