Skip to content

Commit

Permalink
Clone Diff
Browse files Browse the repository at this point in the history
Implementation can not be derived either.
  • Loading branch information
Philippe-Cholet committed Jan 16, 2024
1 parent 0c606cc commit eeda182
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ where
}
}

impl<I, J> Clone for Diff<I, J>
where
I: Iterator,
J: Iterator,
PutBack<I>: Clone,
PutBack<J>: Clone,
{
fn clone(&self) -> Self {
match self {
Self::FirstMismatch(idx, i, j) => Self::FirstMismatch(*idx, i.clone(), j.clone()),
Self::Shorter(idx, i) => Self::Shorter(*idx, i.clone()),
Self::Longer(idx, j) => Self::Longer(*idx, j.clone()),
}
}
}

/// Compares every element yielded by both `i` and `j` with the given function in lock-step and
/// returns a [`Diff`] which describes how `j` differs from `i`.
///
Expand Down

0 comments on commit eeda182

Please sign in to comment.