Added bytemuck implementations for static storages.
This commit is contained in:
parent
6ed6084745
commit
c667b1f9c8
|
@ -36,7 +36,6 @@ compare = [ "matrixcompare-core" ]
|
|||
libm = [ "simba/libm" ]
|
||||
libm-force = [ "simba/libm_force" ]
|
||||
|
||||
|
||||
[dependencies]
|
||||
typenum = "1.12"
|
||||
generic-array = "0.14"
|
||||
|
@ -55,6 +54,7 @@ mint = { version = "0.5", optional = true }
|
|||
quickcheck = { version = "0.9", optional = true }
|
||||
pest = { version = "2", optional = true }
|
||||
pest_derive = { version = "2", optional = true }
|
||||
bytemuck = { version = "1.5", optional = true }
|
||||
matrixcompare-core = { version = "0.1", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -279,6 +279,25 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> matrixcompare_core::DenseAc
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "bytemuck")]
|
||||
unsafe impl<N: Scalar + Copy, R: crate::base::dimension::DimName, C: crate::base::dimension::DimName>
|
||||
bytemuck::Zeroable for Matrix<N, R, C, crate::base::ArrayStorage<N, R, C>>
|
||||
where
|
||||
R::Value: core::ops::Mul<C::Value>,
|
||||
<R::Value as core::ops::Mul<C::Value>>::Output: generic_array::ArrayLength<N>,
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(feature = "bytemuck")]
|
||||
unsafe impl<N: Scalar + Copy, R: crate::base::dimension::DimName, C: crate::base::dimension::DimName>
|
||||
bytemuck::Pod for Matrix<N, R, C, crate::base::ArrayStorage<N, R, C>>
|
||||
where
|
||||
R::Value: core::ops::Mul<C::Value>,
|
||||
<R::Value as core::ops::Mul<C::Value>>::Output: generic_array::ArrayLength<N>,
|
||||
<<R::Value as core::ops::Mul<<C as crate::base::dimension::DimName>::Value>>::Output as generic_array::ArrayLength<N>>::ArrayType: Copy
|
||||
{
|
||||
}
|
||||
|
||||
impl<N: Scalar, R: Dim, C: Dim, S> Matrix<N, R, C, S> {
|
||||
/// Creates a new matrix with the given data without statically checking that the matrix
|
||||
/// dimension matches the storage dimension.
|
||||
|
|
Loading…
Reference in New Issue