Skip to content

Commit 0f66403

Browse files
jswrennsebcrozet
authored andcommitted
Rename MatrixVec to VecStorage.
See #470.
1 parent b83c3b8 commit 0f66403

6 files changed

Lines changed: 60 additions & 56 deletions

File tree

src/base/alias.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use base::dimension::Dynamic;
33
use base::dimension::{U1, U2, U3, U4, U5, U6};
44
#[cfg(any(feature = "std", feature = "alloc"))]
5-
use base::matrix_vec::MatrixVec;
5+
use base::vec_storage::VecStorage;
66
use base::storage::Owned;
77
use base::Matrix;
88

@@ -119,7 +119,7 @@ pub type Matrix6x5<N> = MatrixMN<N, U6, U5>;
119119
*/
120120
/// A dynamically sized column vector.
121121
#[cfg(any(feature = "std", feature = "alloc"))]
122-
pub type DVector<N> = Matrix<N, Dynamic, U1, MatrixVec<N, Dynamic, U1>>;
122+
pub type DVector<N> = Matrix<N, Dynamic, U1, VecStorage<N, Dynamic, U1>>;
123123

124124
/// A statically sized D-dimensional column vector.
125125
pub type VectorN<N, D> = MatrixMN<N, D, U1>;
@@ -146,7 +146,7 @@ pub type Vector6<N> = VectorN<N, U6>;
146146
*/
147147
/// A dynamically sized row vector.
148148
#[cfg(any(feature = "std", feature = "alloc"))]
149-
pub type RowDVector<N> = Matrix<N, U1, Dynamic, MatrixVec<N, U1, Dynamic>>;
149+
pub type RowDVector<N> = Matrix<N, U1, Dynamic, VecStorage<N, U1, Dynamic>>;
150150

151151
/// A statically sized D-dimensional row vector.
152152
pub type RowVectorN<N, D> = MatrixMN<N, U1, D>;

src/base/conversion.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use base::dimension::{
1717
use base::iter::{MatrixIter, MatrixIterMut};
1818
use base::storage::{ContiguousStorage, ContiguousStorageMut, Storage, StorageMut};
1919
#[cfg(any(feature = "std", feature = "alloc"))]
20-
use base::MatrixVec;
20+
use base::VecStorage;
2121
use base::{DefaultAllocator, Matrix, ArrayStorage, MatrixMN, MatrixSlice, MatrixSliceMut, Scalar};
2222

2323
// FIXME: too bad this won't work allo slice conversions.
@@ -353,7 +353,7 @@ where
353353

354354
#[cfg(any(feature = "std", feature = "alloc"))]
355355
impl<'a, N, C, RStride, CStride> From<MatrixSlice<'a, N, Dynamic, C, RStride, CStride>>
356-
for Matrix<N, Dynamic, C, MatrixVec<N, Dynamic, C>>
356+
for Matrix<N, Dynamic, C, VecStorage<N, Dynamic, C>>
357357
where
358358
N: Scalar,
359359
C: Dim,
@@ -367,7 +367,7 @@ where
367367

368368
#[cfg(any(feature = "std", feature = "alloc"))]
369369
impl<'a, N, R, RStride, CStride> From<MatrixSlice<'a, N, R, Dynamic, RStride, CStride>>
370-
for Matrix<N, R, Dynamic, MatrixVec<N, R, Dynamic>>
370+
for Matrix<N, R, Dynamic, VecStorage<N, R, Dynamic>>
371371
where
372372
N: Scalar,
373373
R: DimName,
@@ -397,7 +397,7 @@ where
397397

398398
#[cfg(any(feature = "std", feature = "alloc"))]
399399
impl<'a, N, C, RStride, CStride> From<MatrixSliceMut<'a, N, Dynamic, C, RStride, CStride>>
400-
for Matrix<N, Dynamic, C, MatrixVec<N, Dynamic, C>>
400+
for Matrix<N, Dynamic, C, VecStorage<N, Dynamic, C>>
401401
where
402402
N: Scalar,
403403
C: Dim,
@@ -411,7 +411,7 @@ where
411411

412412
#[cfg(any(feature = "std", feature = "alloc"))]
413413
impl<'a, N, R, RStride, CStride> From<MatrixSliceMut<'a, N, R, Dynamic, RStride, CStride>>
414-
for Matrix<N, R, Dynamic, MatrixVec<N, R, Dynamic>>
414+
for Matrix<N, R, Dynamic, VecStorage<N, R, Dynamic>>
415415
where
416416
N: Scalar,
417417
R: DimName,

src/base/default_allocator.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use base::dimension::Dynamic;
2020
use base::dimension::{Dim, DimName};
2121
use base::array_storage::ArrayStorage;
2222
#[cfg(any(feature = "std", feature = "alloc"))]
23-
use base::matrix_vec::MatrixVec;
23+
use base::vec_storage::VecStorage;
2424
use base::storage::{Storage, StorageMut};
2525
use base::Scalar;
2626

@@ -29,7 +29,7 @@ use base::Scalar;
2929
* Allocator.
3030
*
3131
*/
32-
/// An allocator based on `GenericArray` and `MatrixVec` for statically-sized and dynamically-sized
32+
/// An allocator based on `GenericArray` and `VecStorage` for statically-sized and dynamically-sized
3333
/// matrices respectively.
3434
pub struct DefaultAllocator;
3535

@@ -77,7 +77,7 @@ where
7777
// Dynamic - Dynamic
7878
#[cfg(any(feature = "std", feature = "alloc"))]
7979
impl<N: Scalar, C: Dim> Allocator<N, Dynamic, C> for DefaultAllocator {
80-
type Buffer = MatrixVec<N, Dynamic, C>;
80+
type Buffer = VecStorage<N, Dynamic, C>;
8181

8282
#[inline]
8383
unsafe fn allocate_uninitialized(nrows: Dynamic, ncols: C) -> Self::Buffer {
@@ -86,7 +86,7 @@ impl<N: Scalar, C: Dim> Allocator<N, Dynamic, C> for DefaultAllocator {
8686
res.reserve_exact(length);
8787
res.set_len(length);
8888

89-
MatrixVec::new(nrows, ncols, res)
89+
VecStorage::new(nrows, ncols, res)
9090
}
9191

9292
#[inline]
@@ -101,14 +101,14 @@ impl<N: Scalar, C: Dim> Allocator<N, Dynamic, C> for DefaultAllocator {
101101
assert!(res.len() == nrows.value() * ncols.value(),
102102
"Allocation from iterator error: the iterator did not yield the correct number of elements.");
103103

104-
MatrixVec::new(nrows, ncols, res)
104+
VecStorage::new(nrows, ncols, res)
105105
}
106106
}
107107

108108
// Static - Dynamic
109109
#[cfg(any(feature = "std", feature = "alloc"))]
110110
impl<N: Scalar, R: DimName> Allocator<N, R, Dynamic> for DefaultAllocator {
111-
type Buffer = MatrixVec<N, R, Dynamic>;
111+
type Buffer = VecStorage<N, R, Dynamic>;
112112

113113
#[inline]
114114
unsafe fn allocate_uninitialized(nrows: R, ncols: Dynamic) -> Self::Buffer {
@@ -117,7 +117,7 @@ impl<N: Scalar, R: DimName> Allocator<N, R, Dynamic> for DefaultAllocator {
117117
res.reserve_exact(length);
118118
res.set_len(length);
119119

120-
MatrixVec::new(nrows, ncols, res)
120+
VecStorage::new(nrows, ncols, res)
121121
}
122122

123123
#[inline]
@@ -132,7 +132,7 @@ impl<N: Scalar, R: DimName> Allocator<N, R, Dynamic> for DefaultAllocator {
132132
assert!(res.len() == nrows.value() * ncols.value(),
133133
"Allocation from iterator error: the iterator did not yield the correct number of elements.");
134134

135-
MatrixVec::new(nrows, ncols, res)
135+
VecStorage::new(nrows, ncols, res)
136136
}
137137
}
138138

@@ -186,7 +186,7 @@ where
186186
rto: Dynamic,
187187
cto: CTo,
188188
buf: ArrayStorage<N, RFrom, CFrom>,
189-
) -> MatrixVec<N, Dynamic, CTo>
189+
) -> VecStorage<N, Dynamic, CTo>
190190
{
191191
let mut res = <Self as Allocator<N, Dynamic, CTo>>::allocate_uninitialized(rto, cto);
192192

@@ -215,7 +215,7 @@ where
215215
rto: RTo,
216216
cto: Dynamic,
217217
buf: ArrayStorage<N, RFrom, CFrom>,
218-
) -> MatrixVec<N, RTo, Dynamic>
218+
) -> VecStorage<N, RTo, Dynamic>
219219
{
220220
let mut res = <Self as Allocator<N, RTo, Dynamic>>::allocate_uninitialized(rto, cto);
221221

@@ -238,11 +238,11 @@ impl<N: Scalar, CFrom: Dim, CTo: Dim> Reallocator<N, Dynamic, CFrom, Dynamic, CT
238238
unsafe fn reallocate_copy(
239239
rto: Dynamic,
240240
cto: CTo,
241-
buf: MatrixVec<N, Dynamic, CFrom>,
242-
) -> MatrixVec<N, Dynamic, CTo>
241+
buf: VecStorage<N, Dynamic, CFrom>,
242+
) -> VecStorage<N, Dynamic, CTo>
243243
{
244244
let new_buf = buf.resize(rto.value() * cto.value());
245-
MatrixVec::new(rto, cto, new_buf)
245+
VecStorage::new(rto, cto, new_buf)
246246
}
247247
}
248248

@@ -254,11 +254,11 @@ impl<N: Scalar, CFrom: Dim, RTo: DimName> Reallocator<N, Dynamic, CFrom, RTo, Dy
254254
unsafe fn reallocate_copy(
255255
rto: RTo,
256256
cto: Dynamic,
257-
buf: MatrixVec<N, Dynamic, CFrom>,
258-
) -> MatrixVec<N, RTo, Dynamic>
257+
buf: VecStorage<N, Dynamic, CFrom>,
258+
) -> VecStorage<N, RTo, Dynamic>
259259
{
260260
let new_buf = buf.resize(rto.value() * cto.value());
261-
MatrixVec::new(rto, cto, new_buf)
261+
VecStorage::new(rto, cto, new_buf)
262262
}
263263
}
264264

@@ -270,11 +270,11 @@ impl<N: Scalar, RFrom: DimName, CTo: Dim> Reallocator<N, RFrom, Dynamic, Dynamic
270270
unsafe fn reallocate_copy(
271271
rto: Dynamic,
272272
cto: CTo,
273-
buf: MatrixVec<N, RFrom, Dynamic>,
274-
) -> MatrixVec<N, Dynamic, CTo>
273+
buf: VecStorage<N, RFrom, Dynamic>,
274+
) -> VecStorage<N, Dynamic, CTo>
275275
{
276276
let new_buf = buf.resize(rto.value() * cto.value());
277-
MatrixVec::new(rto, cto, new_buf)
277+
VecStorage::new(rto, cto, new_buf)
278278
}
279279
}
280280

@@ -286,10 +286,10 @@ impl<N: Scalar, RFrom: DimName, RTo: DimName> Reallocator<N, RFrom, Dynamic, RTo
286286
unsafe fn reallocate_copy(
287287
rto: RTo,
288288
cto: Dynamic,
289-
buf: MatrixVec<N, RFrom, Dynamic>,
290-
) -> MatrixVec<N, RTo, Dynamic>
289+
buf: VecStorage<N, RFrom, Dynamic>,
290+
) -> VecStorage<N, RTo, Dynamic>
291291
{
292292
let new_buf = buf.resize(rto.value() * cto.value());
293-
MatrixVec::new(rto, cto, new_buf)
293+
VecStorage::new(rto, cto, new_buf)
294294
}
295295
}

src/base/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ mod matrix_alga;
2323
mod array_storage;
2424
mod matrix_slice;
2525
#[cfg(any(feature = "std", feature = "alloc"))]
26-
mod matrix_vec;
26+
mod vec_storage;
2727
mod properties;
2828
mod scalar;
2929
mod swizzle;
@@ -44,4 +44,4 @@ pub use self::alias_slice::*;
4444
pub use self::array_storage::*;
4545
pub use self::matrix_slice::*;
4646
#[cfg(any(feature = "std", feature = "alloc"))]
47-
pub use self::matrix_vec::*;
47+
pub use self::vec_storage::*;

src/base/storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub type CStride<N, R, C = U1> =
3434
/// Note that `Self` must always have a number of elements compatible with the matrix length (given
3535
/// by `R` and `C` if they are known at compile-time). For example, implementors of this trait
3636
/// should **not** allow the user to modify the size of the underlying buffer with safe methods
37-
/// (for example the `MatrixVec::data_mut` method is unsafe because the user could change the
37+
/// (for example the `VecStorage::data_mut` method is unsafe because the user could change the
3838
/// vector's size so that it no longer contains enough elements: this will lead to UB.
3939
pub unsafe trait Storage<N: Scalar, R: Dim, C: Dim = U1>: Debug + Sized {
4040
/// The static stride of this storage's rows.

0 commit comments

Comments
 (0)