File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,18 @@ impl MathOp {
254254
255255 /// Returns `true` if this operation error'ed due to division by zero.
256256 pub fn is_div_by_zero ( self ) -> bool { !self . is_overflow ( ) }
257+
258+ /// Returns `true` if this operation error'ed due to addition.
259+ pub fn is_addition ( self ) -> bool { self == MathOp :: Add }
260+
261+ /// Returns `true` if this operation error'ed due to subtraction.
262+ pub fn is_subtraction ( self ) -> bool { self == MathOp :: Sub }
263+
264+ /// Returns `true` if this operation error'ed due to multiplication.
265+ pub fn is_multiplication ( self ) -> bool { self == MathOp :: Mul }
266+
267+ /// Returns `true` if this operation error'ed due to negation.
268+ pub fn is_negation ( self ) -> bool { self == MathOp :: Neg }
257269}
258270
259271impl fmt:: Display for MathOp {
You can’t perform that action at this time.
0 commit comments