Fixed RowVector creation from slice not possible in no-std build

This commit is contained in:
Tastaturtaste 2023-11-12 19:00:30 +01:00
parent 06e85477a9
commit fd5513f1cf
1 changed files with 18 additions and 6 deletions

View File

@ -11,13 +11,13 @@ use crate::base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstr
use crate::base::dimension::{ use crate::base::dimension::{
Const, Dim, U1, U10, U11, U12, U13, U14, U15, U16, U2, U3, U4, U5, U6, U7, U8, U9, Const, Dim, U1, U10, U11, U12, U13, U14, U15, U16, U2, U3, U4, U5, U6, U7, U8, U9,
}; };
#[cfg(any(feature = "std", feature = "alloc"))]
use crate::base::dimension::{DimName, Dyn}; use crate::base::dimension::{DimName, Dyn};
use crate::base::iter::{MatrixIter, MatrixIterMut}; use crate::base::iter::{MatrixIter, MatrixIterMut};
use crate::base::storage::{IsContiguous, RawStorage, RawStorageMut}; use crate::base::storage::{IsContiguous, RawStorage, RawStorageMut};
use crate::base::{ use crate::base::{
ArrayStorage, DVectorView, DVectorViewMut, RowDVectorView, RowDVectorViewMut, DefaultAllocator, Matrix, MatrixView, MatrixViewMut, ArrayStorage, DVectorView, DVectorViewMut, DefaultAllocator, Matrix, MatrixView, MatrixViewMut,
OMatrix, Scalar, OMatrix, RowDVectorView, RowDVectorViewMut, Scalar,
}; };
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
use crate::base::{DVector, RowDVector, VecStorage}; use crate::base::{DVector, RowDVector, VecStorage};
@ -535,7 +535,13 @@ impl<'a, T: Scalar> From<DVectorViewMut<'a, T>> for &'a mut [T] {
impl<'a, T: Scalar + Copy> From<&'a [T]> for RowDVectorView<'a, T, Dyn, U1> { impl<'a, T: Scalar + Copy> From<&'a [T]> for RowDVectorView<'a, T, Dyn, U1> {
#[inline] #[inline]
fn from(slice: &'a [T]) -> Self { fn from(slice: &'a [T]) -> Self {
Self::from_slice_with_strides_generic(slice, U1::name(), Dyn(slice.len()), Dyn(slice.len()), U1::name()) Self::from_slice_with_strides_generic(
slice,
U1::name(),
Dyn(slice.len()),
Dyn(slice.len()),
U1::name(),
)
} }
} }
@ -548,7 +554,13 @@ impl<'a, T: Scalar> From<RowDVectorView<'a, T, Dyn, U1>> for &'a [T] {
impl<'a, T: Scalar + Copy> From<&'a mut [T]> for RowDVectorViewMut<'a, T, Dyn, U1> { impl<'a, T: Scalar + Copy> From<&'a mut [T]> for RowDVectorViewMut<'a, T, Dyn, U1> {
#[inline] #[inline]
fn from(slice: &'a mut [T]) -> Self { fn from(slice: &'a mut [T]) -> Self {
Self::from_slice_with_strides_generic(slice, U1::name(), Dyn(slice.len()), Dyn(slice.len()), U1::name()) Self::from_slice_with_strides_generic(
slice,
U1::name(),
Dyn(slice.len()),
Dyn(slice.len()),
U1::name(),
)
} }
} }