diff --git a/src/base/matrix_array.rs b/src/base/array_storage.rs similarity index 84% rename from src/base/matrix_array.rs rename to src/base/array_storage.rs index 384b3ae5..f1a0ea13 100644 --- a/src/base/matrix_array.rs +++ b/src/base/array_storage.rs @@ -34,7 +34,7 @@ use base::Scalar; */ /// A array-based statically sized matrix data storage. #[repr(C)] -pub struct MatrixArray +pub struct ArrayStorage where R: DimName, C: DimName, @@ -44,7 +44,11 @@ where data: GenericArray>, } -impl Hash for MatrixArray +#[deprecated(note="renamed to `ArrayStorage`")] +/// Renamed to [ArrayStorage]. +pub type MatrixArray = ArrayStorage; + +impl Hash for ArrayStorage where N: Hash, R: DimName, @@ -57,7 +61,7 @@ where } } -impl Deref for MatrixArray +impl Deref for ArrayStorage where R: DimName, C: DimName, @@ -72,7 +76,7 @@ where } } -impl DerefMut for MatrixArray +impl DerefMut for ArrayStorage where R: DimName, C: DimName, @@ -85,7 +89,7 @@ where } } -impl Debug for MatrixArray +impl Debug for ArrayStorage where N: Debug, R: DimName, @@ -99,7 +103,7 @@ where } } -impl Copy for MatrixArray +impl Copy for ArrayStorage where N: Copy, R: DimName, @@ -109,7 +113,7 @@ where GenericArray>: Copy, {} -impl Clone for MatrixArray +impl Clone for ArrayStorage where N: Clone, R: DimName, @@ -119,13 +123,13 @@ where { #[inline] fn clone(&self) -> Self { - MatrixArray { + ArrayStorage { data: self.data.clone(), } } } -impl Eq for MatrixArray +impl Eq for ArrayStorage where N: Eq, R: DimName, @@ -134,7 +138,7 @@ where Prod: ArrayLength, {} -impl PartialEq for MatrixArray +impl PartialEq for ArrayStorage where N: PartialEq, R: DimName, @@ -148,7 +152,7 @@ where } } -unsafe impl Storage for MatrixArray +unsafe impl Storage for ArrayStorage where N: Scalar, R: DimName, @@ -200,7 +204,7 @@ where } } -unsafe impl StorageMut for MatrixArray +unsafe impl StorageMut for ArrayStorage where N: Scalar, R: DimName, @@ -220,7 +224,7 @@ where } } -unsafe impl ContiguousStorage for MatrixArray +unsafe impl ContiguousStorage for ArrayStorage where N: Scalar, R: DimName, @@ -230,7 +234,7 @@ where DefaultAllocator: Allocator, {} -unsafe impl ContiguousStorageMut for MatrixArray +unsafe impl ContiguousStorageMut for ArrayStorage where N: Scalar, R: DimName, @@ -247,7 +251,7 @@ where */ // XXX: open an issue for GenericArray so that it implements serde traits? #[cfg(feature = "serde-serialize")] -impl Serialize for MatrixArray +impl Serialize for ArrayStorage where N: Scalar + Serialize, R: DimName, @@ -268,7 +272,7 @@ where } #[cfg(feature = "serde-serialize")] -impl<'a, N, R, C> Deserialize<'a> for MatrixArray +impl<'a, N, R, C> Deserialize<'a> for ArrayStorage where N: Scalar + Deserialize<'a>, R: DimName, @@ -278,18 +282,18 @@ where { fn deserialize(deserializer: D) -> Result where D: Deserializer<'a> { - deserializer.deserialize_seq(MatrixArrayVisitor::new()) + deserializer.deserialize_seq(ArrayStorageVisitor::new()) } } #[cfg(feature = "serde-serialize")] /// A visitor that produces a matrix array. -struct MatrixArrayVisitor { +struct ArrayStorageVisitor { marker: PhantomData<(N, R, C)>, } #[cfg(feature = "serde-serialize")] -impl MatrixArrayVisitor +impl ArrayStorageVisitor where N: Scalar, R: DimName, @@ -299,14 +303,14 @@ where { /// Construct a new sequence visitor. pub fn new() -> Self { - MatrixArrayVisitor { + ArrayStorageVisitor { marker: PhantomData, } } } #[cfg(feature = "serde-serialize")] -impl<'a, N, R, C> Visitor<'a> for MatrixArrayVisitor +impl<'a, N, R, C> Visitor<'a> for ArrayStorageVisitor where N: Scalar + Deserialize<'a>, R: DimName, @@ -314,14 +318,14 @@ where R::Value: Mul, Prod: ArrayLength, { - type Value = MatrixArray; + type Value = ArrayStorage; fn expecting(&self, formatter: &mut Formatter) -> fmt::Result { formatter.write_str("a matrix array") } #[inline] - fn visit_seq(self, mut visitor: V) -> Result, V::Error> + fn visit_seq(self, mut visitor: V) -> Result, V::Error> where V: SeqAccess<'a> { let mut out: Self::Value = unsafe { mem::uninitialized() }; let mut curr = 0; @@ -340,7 +344,7 @@ where } #[cfg(feature = "abomonation-serialize")] -impl Abomonation for MatrixArray +impl Abomonation for ArrayStorage where R: DimName, C: DimName, diff --git a/src/base/conversion.rs b/src/base/conversion.rs index 930fc24d..d2130a5d 100644 --- a/src/base/conversion.rs +++ b/src/base/conversion.rs @@ -18,7 +18,7 @@ use base::iter::{MatrixIter, MatrixIterMut}; use base::storage::{ContiguousStorage, ContiguousStorageMut, Storage, StorageMut}; #[cfg(any(feature = "std", feature = "alloc"))] use base::MatrixVec; -use base::{DefaultAllocator, Matrix, MatrixArray, MatrixMN, MatrixSlice, MatrixSliceMut, Scalar}; +use base::{DefaultAllocator, Matrix, ArrayStorage, MatrixMN, MatrixSlice, MatrixSliceMut, Scalar}; // FIXME: too bad this won't work allo slice conversions. impl SubsetOf> for MatrixMN @@ -336,7 +336,7 @@ impl_from_into_mint_2D!( ); impl<'a, N, R, C, RStride, CStride> From> - for Matrix> + for Matrix> where N: Scalar, R: DimName, @@ -380,7 +380,7 @@ where } impl<'a, N, R, C, RStride, CStride> From> - for Matrix> + for Matrix> where N: Scalar, R: DimName, diff --git a/src/base/default_allocator.rs b/src/base/default_allocator.rs index 6bdbd30d..49cd1d1d 100644 --- a/src/base/default_allocator.rs +++ b/src/base/default_allocator.rs @@ -18,7 +18,7 @@ use base::allocator::{Allocator, Reallocator}; #[cfg(any(feature = "alloc", feature = "std"))] use base::dimension::Dynamic; use base::dimension::{Dim, DimName}; -use base::matrix_array::MatrixArray; +use base::array_storage::ArrayStorage; #[cfg(any(feature = "std", feature = "alloc"))] use base::matrix_vec::MatrixVec; use base::storage::{Storage, StorageMut}; @@ -42,7 +42,7 @@ where R::Value: Mul, Prod: ArrayLength, { - type Buffer = MatrixArray; + type Buffer = ArrayStorage; #[inline] unsafe fn allocate_uninitialized(_: R, _: C) -> Self::Buffer { @@ -157,7 +157,7 @@ where rto: RTo, cto: CTo, buf: >::Buffer, - ) -> MatrixArray + ) -> ArrayStorage { let mut res = >::allocate_uninitialized(rto, cto); @@ -185,7 +185,7 @@ where unsafe fn reallocate_copy( rto: Dynamic, cto: CTo, - buf: MatrixArray, + buf: ArrayStorage, ) -> MatrixVec { let mut res = >::allocate_uninitialized(rto, cto); @@ -214,7 +214,7 @@ where unsafe fn reallocate_copy( rto: RTo, cto: Dynamic, - buf: MatrixArray, + buf: ArrayStorage, ) -> MatrixVec { let mut res = >::allocate_uninitialized(rto, cto); diff --git a/src/base/mod.rs b/src/base/mod.rs index 2f573025..fca573c4 100644 --- a/src/base/mod.rs +++ b/src/base/mod.rs @@ -20,7 +20,7 @@ mod conversion; mod edition; mod matrix; mod matrix_alga; -mod matrix_array; +mod array_storage; mod matrix_slice; #[cfg(any(feature = "std", feature = "alloc"))] mod matrix_vec; @@ -41,7 +41,7 @@ pub use self::dimension::*; pub use self::alias::*; pub use self::alias_slice::*; -pub use self::matrix_array::*; +pub use self::array_storage::*; pub use self::matrix_slice::*; #[cfg(any(feature = "std", feature = "alloc"))] pub use self::matrix_vec::*;