From 01d67134adb930b3b27c32d59115707311ef1c02 Mon Sep 17 00:00:00 2001 From: Jim Turner Date: Mon, 31 May 2021 21:59:10 -0400 Subject: [PATCH] Implement RawDataSubst for CowRepr --- src/data_traits.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/data_traits.rs b/src/data_traits.rs index bd540b1b8..0f690a90e 100644 --- a/src/data_traits.rs +++ b/src/data_traits.rs @@ -675,3 +675,13 @@ impl<'a, A: 'a, B: 'a> RawDataSubst for ViewRepr<&'a mut A> { } } +impl<'a, A: 'a, B: 'a> RawDataSubst 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()), + } + } +}