diff --git a/src/lib.rs b/src/lib.rs index 2587af5..ef1b910 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -229,6 +229,30 @@ impl ExactSlice { } } +impl<'a, T, const N: usize> Into<&'a MinSlice> for &'a ExactSlice { + fn into(self) -> &'a MinSlice { + self.as_min_slice() + } +} + +impl<'a, T, const N: usize> Into<&'a mut MinSlice> for &'a mut ExactSlice { + fn into(self) -> &'a mut MinSlice { + self.as_mut_min_slice() + } +} + +impl<'a, T, const N: usize> Into<&'a ExactSlice> for &'a MinSlice { + fn into(self) -> &'a ExactSlice { + unsafe { ExactSlice::from_slice_unchecked(&self.head[..]) } + } +} + +impl<'a, T, const N: usize> Into<&'a mut ExactSlice> for &'a mut MinSlice { + fn into(self) -> &'a mut ExactSlice { + unsafe { ExactSlice::from_mut_unchecked(&mut self.head[..]) } + } +} + #[test] fn basic_min_success() { let slice = &[1, 2, 3, 4, 5, 6];