Enum math_parse::MathParseErrors
source · pub enum MathParseErrors {
Show 13 variants
UnclosedParenthesis,
UnopenedParenthesis,
EmptyLine,
InvalidNumber(String),
MisplacedOperator(char),
TrailingOperator,
IntConversion(f64),
BinaryOpOnFloat(f64, char),
ReturnFloatExpectedInt(f64),
BadOperatorHint(char, &'static str),
UnexpectedZero,
UnexpectedNegative,
MathParseInternalBug(String),
}Expand description
Type used to represent any errors that can happen in the parsing of a math expression.
Variants§
UnclosedParenthesis
A parenthesis was opened but never closed.
UnopenedParenthesis
A closing parenthesis was used with no matching open parenthesis.
EmptyLine
The math expression is empty. Or the right hand side of an operator is empty.
InvalidNumber(String)
An expression that should have been a number but can’t be read.
MisplacedOperator(char)
An operator is not where it should be. Like a “*” after a “+”, or the left hand side of an operator being empty.
TrailingOperator
An operator is the last element of a line of math.
IntConversion(f64)
A float could not be converted to an int.
BinaryOpOnFloat(f64, char)
A binary operation have been tried on a float.
ReturnFloatExpectedInt(f64)
We wanted to return an int but we got a float instead.
BadOperatorHint(char, &'static str)
A given operator was invalid, but we can suggest an other instead.
UnexpectedZero
There was an unwanted zero.
UnexpectedNegative
There was an unwanted negative number.
MathParseInternalBug(String)
This error should never be raised and should be reported to the library’s maintainer.
Trait Implementations§
source§impl Debug for MathParseErrors
impl Debug for MathParseErrors
source§impl Display for MathParseErrors
impl Display for MathParseErrors
source§impl PartialEq for MathParseErrors
impl PartialEq for MathParseErrors
source§fn eq(&self, other: &MathParseErrors) -> bool
fn eq(&self, other: &MathParseErrors) -> bool
self and other values to be equal, and is used
by ==.