Make the change type be generic over any T rather &T (#31)

This makes the interface of this crate more flexible as the utility
methods such as `iter_changes` now also work if a container does not
contain references.
This commit is contained in:
Armin Ronacher 2021-09-11 11:20:51 +02:00 committed by GitHub
parent 0b8e237280
commit a3e10af892
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 75 additions and 37 deletions

View file

@ -159,8 +159,8 @@ impl<'s, T: DiffableStr + ?Sized> InlineChange<'s, T> {
}
}
impl<'s, T: DiffableStr + ?Sized> From<Change<'s, T>> for InlineChange<'s, T> {
fn from(change: Change<'s, T>) -> InlineChange<'s, T> {
impl<'s, T: DiffableStr + ?Sized> From<Change<&'s T>> for InlineChange<'s, T> {
fn from(change: Change<&'s T>) -> InlineChange<'s, T> {
InlineChange {
tag: change.tag(),
old_index: change.old_index(),