From 3abeae04f538bfb6d0a19912e06686dfe0b08bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Mon, 1 Oct 2018 05:30:28 +0200 Subject: [PATCH] Add conditional compilation to From impls for dynamically-sized matrices. --- src/base/conversion.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/base/conversion.rs b/src/base/conversion.rs index 2d857a69..8c0c2e00 100644 --- a/src/base/conversion.rs +++ b/src/base/conversion.rs @@ -343,12 +343,12 @@ where R::Value: Mul, Prod: ArrayLength, { - fn from(matrix_slice: MatrixSlice<'a, N, R, C, RStride, CStride>) -> Self - { + fn from(matrix_slice: MatrixSlice<'a, N, R, C, RStride, CStride>) -> Self { matrix_slice.into_owned() } } +#[cfg(any(feature = "std", feature = "alloc"))] impl<'a, N, C, RStride, CStride> From> for Matrix> where @@ -357,12 +357,12 @@ where RStride: Dim, CStride: Dim, { - fn from(matrix_slice: MatrixSlice<'a, N, Dynamic, C, RStride, CStride>) -> Self - { + fn from(matrix_slice: MatrixSlice<'a, N, Dynamic, C, RStride, CStride>) -> Self { matrix_slice.into_owned() } } +#[cfg(any(feature = "std", feature = "alloc"))] impl<'a, N, R, RStride, CStride> From> for Matrix> where @@ -371,8 +371,7 @@ where RStride: Dim, CStride: Dim, { - fn from(matrix_slice: MatrixSlice<'a, N, R, Dynamic, RStride, CStride>) -> Self - { + fn from(matrix_slice: MatrixSlice<'a, N, R, Dynamic, RStride, CStride>) -> Self { matrix_slice.into_owned() } } @@ -388,12 +387,12 @@ where R::Value: Mul, Prod: ArrayLength, { - fn from(matrix_slice: MatrixSliceMut<'a, N, R, C, RStride, CStride>) -> Self - { + fn from(matrix_slice: MatrixSliceMut<'a, N, R, C, RStride, CStride>) -> Self { matrix_slice.into_owned() } } +#[cfg(any(feature = "std", feature = "alloc"))] impl<'a, N, C, RStride, CStride> From> for Matrix> where @@ -408,6 +407,7 @@ where } } +#[cfg(any(feature = "std", feature = "alloc"))] impl<'a, N, R, RStride, CStride> From> for Matrix> where @@ -416,8 +416,7 @@ where RStride: Dim, CStride: Dim, { - fn from(matrix_slice: MatrixSliceMut<'a, N, R, Dynamic, RStride, CStride>) -> Self - { + fn from(matrix_slice: MatrixSliceMut<'a, N, R, Dynamic, RStride, CStride>) -> Self { matrix_slice.into_owned() } }