Add a `From` impl to convert `DVectorSlice[mut]` back to into a slice.
@@ -452,6 +452,12 @@ impl<'a, T: Scalar + Copy> From<&'a [T]> for DVectorSlice<'a, T> {
}
}
+impl<'a, T: Scalar> From<DVectorSlice<'a, T>> for &'a [T] {
+ fn from(vec: DVectorSlice<'a, T>) -> &'a [T] {
+ vec.data.into_slice()
+ }
+}
+
impl<'a, T: Scalar + Copy> From<&'a mut [T]> for DVectorSliceMut<'a, T> {
#[inline]
fn from(slice: &'a mut [T]) -> Self {
@@ -459,6 +465,12 @@ impl<'a, T: Scalar + Copy> From<&'a mut [T]> for DVectorSliceMut<'a, T> {
}
}
+impl<'a, T: Scalar> From<DVectorSliceMut<'a, T>> for &'a mut [T] {
+ fn from(vec: DVectorSliceMut<'a, T>) -> &'a mut [T] {
+ vec.data.into_slice_mut()
+ }
+}
+
impl<T: Scalar + PrimitiveSimdValue, R: Dim, C: Dim> From<[OMatrix<T::Element, R, C>; 2]>
for OMatrix<T, R, C>
where
