pub enum MathParseErrors {
Show 15 variants
UnclosedParenthesis,
UnopenedParenthesis,
EmptyLine,
InvalidNumber(String),
MisplacedOperator(char),
TrailingOperator,
IntConversion(f64),
BinaryOpOnFloat(f64, char),
ReturnFloatExpectedInt(f64),
BadOperatorHint(char, &'static str),
UnexpectedZero,
UnexpectedNegative,
InvalidRPNOperator(char),
UnbalancedStack,
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.
InvalidRPNOperator(char)
An operator is not valid in the context of RPN parsing.
UnbalancedStack
The number of elements on the RPN stack is not valid.
MathParseInternalBug(String)
This error should never be raised and should be reported to the library’s maintainer.