differ v0.1.1 Differ.Diffable protocol View Source
Allows to compute diff
between terms
Link to this section Summary
Types
List of operations need to be applied
Level of optimization
Defines operator and value that need to be applied with operator
Operators that define how to change data
Diffable term
Functions
Returns a list of tuples that represents an edit script
Optimizes diff operation, to reduce its size
Link to this section Types
List of operations need to be applied
Level of optimization
Defines operator and value that need to be applied with operator
Examples
{:del, "s"}
{:skip, 4}
{"key", :ins, "s"}
Operators that define how to change data
:del
- delete:ins
- insert:eq
- doesnt change:diff
- nested diff that should be applied:skip
- skip number of characters or elements:remove
- remove number of characters or elements (Non-revertable)
Diffable term
Link to this section Functions
Returns a list of tuples that represents an edit script
When implementing this function on a new type, you should always implement this
def diff(term, term), do: [eq: term]
Optimizes diff operation, to reduce its size
If it returns nil, then operation can be excluded from diff