From d65b4574108af79beff94d5fc3c5739e19f811fe Mon Sep 17 00:00:00 2001 From: Lishen Date: Tue, 21 Nov 2023 18:06:22 +0300 Subject: [PATCH] fix build without default features --- src/base/conversion.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/base/conversion.rs b/src/base/conversion.rs index ace35fe4..acb40411 100644 --- a/src/base/conversion.rs +++ b/src/base/conversion.rs @@ -19,14 +19,15 @@ use crate::base::{ ArrayStorage, DVectorView, DVectorViewMut, DefaultAllocator, Matrix, MatrixView, MatrixViewMut, OMatrix, Scalar, }; +//TODO: move near From implementation? #[cfg(any(feature = "std", feature = "alloc"))] -use crate::base::{DVector, RowDVector, VecStorage}; +use crate::base::{DMatrixView, SMatrixView, SVectorView}; + +#[cfg(any(feature = "std", feature = "alloc"))] +use crate::base::{DMatrix, DVector, RowDVector, VecStorage}; use crate::base::{ViewStorage, ViewStorageMut}; use crate::constraint::DimEq; -use crate::{ - DMatrix, DMatrixView, IsNotStaticOne, RowSVector, SMatrix, SMatrixView, SVector, SVectorView, - VectorView, VectorViewMut, -}; +use crate::{IsNotStaticOne, RowSVector, SMatrix, SVector, VectorView, VectorViewMut}; use std::mem::MaybeUninit; // TODO: too bad this won't work for slice conversions. @@ -431,18 +432,23 @@ where } } +#[cfg(any(feature = "std", feature = "alloc"))] impl<'a, T: Scalar, const R: usize, const C: usize> From<&'a DMatrix> for SMatrix { fn from(m: &'a DMatrix) -> Self { let v: DMatrixView<'a, T> = m.as_view(); SMatrixView::::from(&v).clone_owned() } } + +#[cfg(any(feature = "std", feature = "alloc"))] impl<'a, T: Scalar, const R: usize, const C: usize> From<&'a SMatrix> for DMatrix { fn from(m: &'a SMatrix) -> Self { let v: SMatrixView<'a, T, R, C> = m.as_view(); DMatrixView::::from(&v).clone_owned() } } + +#[cfg(any(feature = "std", feature = "alloc"))] impl<'a, T: Scalar, const R: usize> From<&'a DVector> for SVector { fn from(m: &'a DVector) -> Self { let v: DVectorView<'a, T> = m.as_view(); @@ -450,6 +456,7 @@ impl<'a, T: Scalar, const R: usize> From<&'a DVector> for SVector { } } +#[cfg(any(feature = "std", feature = "alloc"))] impl<'a, T: Scalar, const R: usize> From<&'a SVector> for DVector { fn from(m: &'a SVector) -> Self { let v: SVectorView<'a, T, R> = m.as_view();