Change as_tag_tuple to work by reference

This commit is contained in:
Armin Ronacher 2021-01-24 11:25:27 +01:00
parent 16d1eea8fc
commit 1baa23ddcc
3 changed files with 4 additions and 2 deletions

View file

@ -5,6 +5,7 @@ All notable changes to similar are documented here.
## 0.3.0
* Added grapheme and character level diffing utilities.
* `DiffOp::as_tag_tuple` is now taking the argument by reference.
## 0.2.0

View file

@ -68,8 +68,8 @@ impl DiffOp {
/// * `Delete`: `a[i1..i2]` should be deleted (`j1 == j2` in this case).
/// * `Insert`: `b[j1..j2]` should be inserted at `a[i1..i2]` (`i1 == i2` in this case).
/// * `Equal`: `a[i1..i2]` is equal to `b[j1..j2]`.
pub fn as_tag_tuple(self) -> (DiffTag, Range<usize>, Range<usize>) {
match self {
pub fn as_tag_tuple(&self) -> (DiffTag, Range<usize>, Range<usize>) {
match *self {
DiffOp::Equal {
old_index,
new_index,

View file

@ -28,5 +28,6 @@
//! gains the ability to diff on a grapheme instead of character level. This
//! is particularly useful when working with text containing emojis.
//! * `text`: this feature is enabled by default and enables the [`text`] module.
//! If the crate is used without default features it's removed.
pub mod algorithms;
pub mod text;