From 9600c45dd4a46b6cb9c9b98391ca214b57759140 Mon Sep 17 00:00:00 2001 From: Jack Wrenn Date: Sun, 9 Dec 2018 15:32:35 -0500 Subject: [PATCH] Rename `Orthographic3::unwrap` to `Orthographic3::into_inner` and deprecate `Orthographic3::unwrap` See #460 --- src/base/cg.rs | 2 +- src/geometry/orthographic.rs | 12 ++++++++++-- tests/geometry/projection.rs | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/base/cg.rs b/src/base/cg.rs index 63586dc5..212cdc03 100644 --- a/src/base/cg.rs +++ b/src/base/cg.rs @@ -115,7 +115,7 @@ impl Matrix4 { /// 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. diff --git a/src/geometry/orthographic.rs b/src/geometry/orthographic.rs index eb3ce0fa..4a04c8a8 100644 --- a/src/geometry/orthographic.rs +++ b/src/geometry/orthographic.rs @@ -280,9 +280,17 @@ impl Orthographic3 { /// 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 { + 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 { self.matrix } @@ -725,6 +733,6 @@ where Matrix4: Send impl From> for Matrix4 { #[inline] fn from(orth: Orthographic3) -> Self { - orth.unwrap() + orth.into_inner() } } diff --git a/tests/geometry/projection.rs b/tests/geometry/projection.rs index 17d04a13..866d5795 100644 --- a/tests/geometry/projection.rs +++ b/tests/geometry/projection.rs @@ -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)); }