Remove the Deref implementation for MatrixRef.

Fix #380.
This commit is contained in:
sebcrozet 2018-09-13 05:45:14 +02:00
parent 21c163db3a
commit 664658760a
2 changed files with 12 additions and 12 deletions

View File

@ -35,7 +35,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Implement `Extend<Matrix<...>>` for matrices with dynamic storage. This will concatenate the columns of both matrices. * Implement `Extend<Matrix<...>>` for matrices with dynamic storage. This will concatenate the columns of both matrices.
* Implement `Into<Vec>` for the `MatrixVec` storage. * Implement `Into<Vec>` for the `MatrixVec` storage.
* Implement `Hash` for all matrices. * Implement `Hash` for all matrices.
* Add a `.len()` method to retrieve the size of a `MatrixVec`.
### Modified ### Modified
* The orthographic projection no longer require that `bottom < top`, that `left < right`, and that `znear < zfar`. The * The orthographic projection no longer require that `bottom < top`, that `left < right`, and that `znear < zfar`. The
only restriction now ith that they must not be equal (in which case the projection would be singular). only restriction now ith that they must not be equal (in which case the projection would be singular).
@ -46,11 +47,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
* Renamed `.unwrap()` to `.into_inner()` for geometric types that wrap another type. * Renamed `.unwrap()` to `.into_inner()` for geometric types that wrap another type.
This is for the case of `Unit`, `Transform`, `Orthographic3`, `Perspective3`, `Rotation`. This is for the case of `Unit`, `Transform`, `Orthographic3`, `Perspective3`, `Rotation`.
* Deprecate several functions at the root of the crate (replaced by methods). * Deprecate several functions at the root of the crate (replaced by methods).
### Removed
* Remove the `Deref` impl for `MatrixVec` as it could cause hard-to-understand compilation errors.
### nalgebra-glm ### nalgebra-glm
* Add several alternative projection computations, e.g., `ortho_lh`, `ortho_lh_no`, `perspective_lh`, etc. * Add several alternative projection computations, e.g., `ortho_lh`, `ortho_lh_no`, `perspective_lh`, etc.
* Add features matching those of nalgebra, in particular: `serde-serialize`, `abmonation-serialize`, std` (enabled by default). * Add features matching those of nalgebra, in particular: `serde-serialize`, `abmonation-serialize`, std` (enabled by default).
## [0.16.0] ## [0.16.0]
All dependencies have been updated to their latest versions. All dependencies have been updated to their latest versions.

View File

@ -1,6 +1,5 @@
#[cfg(feature = "abomonation-serialize")] #[cfg(feature = "abomonation-serialize")]
use std::io::{Result as IOResult, Write}; use std::io::{Result as IOResult, Write};
use std::ops::Deref;
#[cfg(all(feature = "alloc", not(feature = "std")))] #[cfg(all(feature = "alloc", not(feature = "std")))]
use alloc::vec::Vec; use alloc::vec::Vec;
@ -81,14 +80,11 @@ impl<N, R: Dim, C: Dim> VecStorage<N, R, C> {
self.data self.data
} }
}
impl<N, R: Dim, C: Dim> Deref for VecStorage<N, R, C> {
type Target = Vec<N>;
/// The number of elements on the underlying vector.
#[inline] #[inline]
fn deref(&self) -> &Self::Target { pub fn len(&self) -> usize {
&self.data self.data.len()
} }
} }
@ -145,7 +141,7 @@ where DefaultAllocator: Allocator<N, Dynamic, C, Buffer = Self>
#[inline] #[inline]
fn as_slice(&self) -> &[N] { fn as_slice(&self) -> &[N] {
&self[..] &self.data
} }
} }
@ -189,7 +185,7 @@ where DefaultAllocator: Allocator<N, R, Dynamic, Buffer = Self>
#[inline] #[inline]
fn as_slice(&self) -> &[N] { fn as_slice(&self) -> &[N] {
&self[..] &self.data
} }
} }