Rename Orthographic3::unwrap to Orthographic3::into_inner and deprecate Orthographic3::unwrap

See #460
This commit is contained in:
Jack Wrenn 2018-12-09 15:32:35 -05:00 committed by Sébastien Crozet
parent 43c5f4cb73
commit 9600c45dd4
3 changed files with 12 additions and 4 deletions

View File

@ -115,7 +115,7 @@ impl<N: Real> Matrix4<N> {
/// Creates a new homogeneous matrix for an orthographic projection.
#[inline]
pub fn new_orthographic(left: N, right: N, bottom: N, top: N, znear: N, zfar: N) -> Self {
Orthographic3::new(left, right, bottom, top, znear, zfar).unwrap()
Orthographic3::new(left, right, bottom, top, znear, zfar).into_inner()
}
/// Creates a new homogeneous matrix for a perspective projection.

View File

@ -280,9 +280,17 @@ impl<N: Real> Orthographic3<N> {
/// 0.0, 0.0, -2.0 / 999.9, -1000.1 / 999.9,
/// 0.0, 0.0, 0.0, 1.0
/// );
/// assert_eq!(proj.unwrap(), expected);
/// assert_eq!(proj.into_inner(), expected);
/// ```
#[inline]
pub fn into_inner(self) -> Matrix4<N> {
self.matrix
}
/// Retrieves the underlying homogeneous matrix.
/// Deprecated: Use [Orthographic3::into_inner] instead.
#[deprecated(note="use `.into_inner()` instead")]
#[inline]
pub fn unwrap(self) -> Matrix4<N> {
self.matrix
}
@ -725,6 +733,6 @@ where Matrix4<N>: Send
impl<N: Real> From<Orthographic3<N>> for Matrix4<N> {
#[inline]
fn from(orth: Orthographic3<N>) -> Self {
orth.unwrap()
orth.into_inner()
}
}

View File

@ -15,7 +15,7 @@ fn orthographic_inverse() {
let proj = Orthographic3::new(1.0, 2.0, -3.0, -2.5, 10.0, 900.0);
let inv = proj.inverse();
let id = inv * proj.unwrap();
let id = inv * proj.into_inner();
assert!(id.is_identity(1.0e-7));
}