Remove extend
This commit is contained in:
parent
05cdd68d39
commit
cb1371693d
1 changed files with 0 additions and 18 deletions
|
|
@ -26,22 +26,4 @@ impl RawOperation {
|
||||||
pub fn get_original_text(self) -> String {
|
pub fn get_original_text(self) -> String {
|
||||||
self.tokens().iter().map(|t| t.original.clone()).collect()
|
self.tokens().iter().map(|t| t.original.clone()).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extends the operation with another operation if returning the new operation.
|
|
||||||
/// Only operations of the same type can be used to extend. If the operations are of different
|
|
||||||
/// types, returns None.
|
|
||||||
pub fn extend(&self, other: &RawOperation) -> Option<RawOperation> {
|
|
||||||
match (self, other) {
|
|
||||||
(RawOperation::Insert(tokens1), RawOperation::Insert(tokens2)) => Some(
|
|
||||||
RawOperation::Insert(tokens1.iter().chain(tokens2.iter()).cloned().collect()),
|
|
||||||
),
|
|
||||||
(RawOperation::Delete(tokens1), RawOperation::Delete(tokens2)) => Some(
|
|
||||||
RawOperation::Delete(tokens1.iter().chain(tokens2.iter()).cloned().collect()),
|
|
||||||
),
|
|
||||||
(RawOperation::Equal(tokens1), RawOperation::Equal(tokens2)) => Some(
|
|
||||||
RawOperation::Equal(tokens1.iter().chain(tokens2.iter()).cloned().collect()),
|
|
||||||
),
|
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue