Skip to content

Commit

Permalink
Implement RawDataSubst for CowRepr
Browse files Browse the repository at this point in the history
  • Loading branch information
jturner314 committed Jun 1, 2021
1 parent e7600e8 commit 01d6713
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/data_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -675,3 +675,13 @@ impl<'a, A: 'a, B: 'a> RawDataSubst<B> for ViewRepr<&'a mut A> {
}
}

impl<'a, A: 'a, B: 'a> RawDataSubst<B> for CowRepr<'a, A> {
type Output = CowRepr<'a, B>;

unsafe fn data_subst(self) -> Self::Output {
match self {
CowRepr::View(view) => CowRepr::View(view.data_subst()),
CowRepr::Owned(owned) => CowRepr::Owned(owned.data_subst()),
}
}
}

0 comments on commit 01d6713

Please sign in to comment.