Skip to content

Commit eeda182

Browse files
Clone Diff
Implementation can not be derived either.
1 parent 0c606cc commit eeda182

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/diff.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,22 @@ where
4949
}
5050
}
5151

52+
impl<I, J> Clone for Diff<I, J>
53+
where
54+
I: Iterator,
55+
J: Iterator,
56+
PutBack<I>: Clone,
57+
PutBack<J>: Clone,
58+
{
59+
fn clone(&self) -> Self {
60+
match self {
61+
Self::FirstMismatch(idx, i, j) => Self::FirstMismatch(*idx, i.clone(), j.clone()),
62+
Self::Shorter(idx, i) => Self::Shorter(*idx, i.clone()),
63+
Self::Longer(idx, j) => Self::Longer(*idx, j.clone()),
64+
}
65+
}
66+
}
67+
5268
/// Compares every element yielded by both `i` and `j` with the given function in lock-step and
5369
/// returns a [`Diff`] which describes how `j` differs from `i`.
5470
///

0 commit comments

Comments
 (0)