From d739ef1b7909a6442be71737695b35f5d7f382ea Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Sun, 31 Dec 2023 07:50:26 -0800 Subject: [PATCH] Added checks to ZeroToOne division Refs #120 --- src/animation.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/animation.rs b/src/animation.rs index db17b9a..6f8ae60 100644 --- a/src/animation.rs +++ b/src/animation.rs @@ -1289,6 +1289,9 @@ impl MulAssign for ZeroToOne { impl Div for ZeroToOne { type Output = Self; + /// Divides `self` by `rhs`. + /// + /// If `rhs` is `0.`, the result will be [`ZeroToOne::ONE`]. fn div(mut self, rhs: Self) -> Self::Output { self /= rhs; self @@ -1296,6 +1299,9 @@ impl Div for ZeroToOne { } impl DivAssign for ZeroToOne { + /// Divides `self` by `rhs`. + /// + /// If `rhs` is `0.`, the result will be [`ZeroToOne::ONE`]. fn div_assign(&mut self, rhs: Self) { self.checked_div(rhs); } @@ -1306,6 +1312,8 @@ impl Div for ZeroToOne { /// Divides `self` by `rhs`. /// + /// If `rhs` is `0.`, the result will be [`ZeroToOne::ONE`]. + /// /// # Panics /// /// This function panics if `rhs` is not a number. @@ -1318,6 +1326,8 @@ impl Div for ZeroToOne { impl DivAssign for ZeroToOne { /// Divides `self` by `rhs`. /// + /// If `rhs` is `0.`, the result will be [`ZeroToOne::ONE`]. + /// /// # Panics /// /// This function panics if `rhs` is not a number.