#[non_exhaustive]pub enum EvalexprError<NumericTypes: EvalexprNumericTypes = DefaultNumericTypes> {
Show 39 variants
WrongOperatorArgumentAmount {
expected: usize,
actual: usize,
},
WrongFunctionArgumentAmount {
expected: RangeInclusive<usize>,
actual: usize,
},
ExpectedString {
actual: Value<NumericTypes>,
},
ExpectedInt {
actual: Value<NumericTypes>,
},
ExpectedFloat {
actual: Value<NumericTypes>,
},
ExpectedNumber {
actual: Value<NumericTypes>,
},
ExpectedNumberOrString {
actual: Value<NumericTypes>,
},
ExpectedBoolean {
actual: Value<NumericTypes>,
},
ExpectedTuple {
actual: Value<NumericTypes>,
},
ExpectedFixedLengthTuple {
expected_length: usize,
actual: Value<NumericTypes>,
},
ExpectedRangedLengthTuple {
expected_length: RangeInclusive<usize>,
actual: Value<NumericTypes>,
},
ExpectedEmpty {
actual: Value<NumericTypes>,
},
AppendedToLeafNode,
PrecedenceViolation,
VariableIdentifierNotFound(String),
FunctionIdentifierNotFound(String),
TypeError {
expected: Vec<ValueType>,
actual: Value<NumericTypes>,
},
WrongTypeCombination {
operator: Operator<NumericTypes>,
actual: Vec<ValueType>,
},
UnmatchedLBrace,
UnmatchedRBrace,
UnmatchedDoubleQuote,
MissingOperatorOutsideOfBrace,
UnmatchedPartialToken {
first: PartialToken<NumericTypes>,
second: Option<PartialToken<NumericTypes>>,
},
AdditionError {
augend: Value<NumericTypes>,
addend: Value<NumericTypes>,
},
SubtractionError {
minuend: Value<NumericTypes>,
subtrahend: Value<NumericTypes>,
},
NegationError {
argument: Value<NumericTypes>,
},
MultiplicationError {
multiplicand: Value<NumericTypes>,
multiplier: Value<NumericTypes>,
},
DivisionError {
dividend: Value<NumericTypes>,
divisor: Value<NumericTypes>,
},
ModulationError {
dividend: Value<NumericTypes>,
divisor: Value<NumericTypes>,
},
InvalidRegex {
regex: String,
message: String,
},
ContextNotMutable,
IllegalEscapeSequence(String),
BuiltinFunctionsCannotBeEnabled,
BuiltinFunctionsCannotBeDisabled,
OutOfBoundsAccess,
IntFromUsize {
usize_int: usize,
},
IntIntoUsize {
int: NumericTypes::Int,
},
RandNotEnabled,
CustomMessage(String),
}Expand description
Errors used in this crate.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
WrongOperatorArgumentAmount
An operator was called with a wrong amount of arguments.
Fields
WrongFunctionArgumentAmount
A function was called with a wrong amount of arguments.
Fields
expected: RangeInclusive<usize>The expected amount of arguments.
ExpectedString
A string value was expected.
ExpectedInt
An integer value was expected.
ExpectedFloat
A float value was expected.
ExpectedNumber
A numeric value was expected.
Numeric values are the variants Value::Int and Value::Float.
ExpectedNumberOrString
A numeric or string value was expected.
Numeric values are the variants Value::Int and Value::Float.
ExpectedBoolean
A boolean value was expected.
ExpectedTuple
A tuple value was expected.
ExpectedFixedLengthTuple
A tuple value of a certain length was expected.
ExpectedRangedLengthTuple
A tuple value of a certain length range was expected.
Fields
expected_length: RangeInclusive<usize>The expected length range.
ExpectedEmpty
An empty value was expected.
AppendedToLeafNode
Tried to append a child to a leaf node. Leaf nodes cannot have children.
PrecedenceViolation
Tried to append a child to a node such that the precedence of the child is not higher. This error should never occur. If it does, please file a bug report.
VariableIdentifierNotFound(String)
A VariableIdentifier operation did not find its value in the context.
FunctionIdentifierNotFound(String)
A FunctionIdentifier operation did not find its value in the context.
TypeError
A value has the wrong type. Only use this if there is no other error that describes the expected and provided types in more detail.
WrongTypeCombination
An operator is used with a wrong combination of types.
Fields
UnmatchedLBrace
An opening brace without a matching closing brace was found.
UnmatchedRBrace
A closing brace without a matching opening brace was found.
UnmatchedDoubleQuote
A double quote without a matching second double quote was found.
MissingOperatorOutsideOfBrace
Left of an opening brace or right of a closing brace is a token that does not expect the brace next to it.
For example, writing 4(5) would yield this error, as the 4 does not have any operands.
UnmatchedPartialToken
A PartialToken is unmatched, such that it cannot be combined into a full Token.
This happens if for example a single = is found, surrounded by whitespace.
It is not a token, but it is part of the string representation of some tokens.
Fields
first: PartialToken<NumericTypes>The unmatched partial token.
second: Option<PartialToken<NumericTypes>>The token that follows the unmatched partial token and that cannot be matched to the partial token, or None, if first is the last partial token in the stream.
AdditionError
An addition operation performed by Rust failed.
Fields
SubtractionError
A subtraction operation performed by Rust failed.
Fields
NegationError
A negation operation performed by Rust failed.
MultiplicationError
A multiplication operation performed by Rust failed.
Fields
DivisionError
A division operation performed by Rust failed.
Fields
ModulationError
A modulation operation performed by Rust failed.
Fields
InvalidRegex
A regular expression could not be parsed
Fields
ContextNotMutable
A modification was attempted on a Context that does not allow modifications.
IllegalEscapeSequence(String)
An escape sequence within a string literal is illegal.
BuiltinFunctionsCannotBeEnabled
This context does not allow enabling builtin functions.
BuiltinFunctionsCannotBeDisabled
This context does not allow disabling builtin functions.
OutOfBoundsAccess
Out of bounds sequence access.
IntFromUsize
A usize was attempted to be converted to an int, but it was out of range.
IntIntoUsize
An int was attempted to be converted to a usize, but it was out of range.
RandNotEnabled
The feature rand is not enabled, but required for the used function.
CustomMessage(String)
A custom error explained by its message.
Implementations§
Source§impl<NumericTypes: EvalexprNumericTypes> EvalexprError<NumericTypes>
impl<NumericTypes: EvalexprNumericTypes> EvalexprError<NumericTypes>
Sourcepub fn wrong_operator_argument_amount(actual: usize, expected: usize) -> Self
pub fn wrong_operator_argument_amount(actual: usize, expected: usize) -> Self
Construct a WrongOperatorArgumentAmount error.
Sourcepub fn wrong_function_argument_amount(actual: usize, expected: usize) -> Self
pub fn wrong_function_argument_amount(actual: usize, expected: usize) -> Self
Construct a WrongFunctionArgumentAmount error for a function with a fixed amount of arguments.
Sourcepub fn wrong_function_argument_amount_range(
actual: usize,
expected: RangeInclusive<usize>,
) -> Self
pub fn wrong_function_argument_amount_range( actual: usize, expected: RangeInclusive<usize>, ) -> Self
Construct a WrongFunctionArgumentAmount error for a function with a range of possible amounts of arguments.
Sourcepub fn type_error(actual: Value<NumericTypes>, expected: Vec<ValueType>) -> Self
pub fn type_error(actual: Value<NumericTypes>, expected: Vec<ValueType>) -> Self
Constructs EvalexprError::TypeError{actual, expected}.
Sourcepub fn wrong_type_combination(
operator: Operator<NumericTypes>,
actual: Vec<ValueType>,
) -> Self
pub fn wrong_type_combination( operator: Operator<NumericTypes>, actual: Vec<ValueType>, ) -> Self
Constructs EvalexprError::WrongTypeCombination{operator, actual}.
Sourcepub fn expected_string(actual: Value<NumericTypes>) -> Self
pub fn expected_string(actual: Value<NumericTypes>) -> Self
Constructs EvalexprError::ExpectedString{actual}.
Sourcepub fn expected_int(actual: Value<NumericTypes>) -> Self
pub fn expected_int(actual: Value<NumericTypes>) -> Self
Constructs EvalexprError::ExpectedInt{actual}.
Sourcepub fn expected_float(actual: Value<NumericTypes>) -> Self
pub fn expected_float(actual: Value<NumericTypes>) -> Self
Constructs EvalexprError::ExpectedFloat{actual}.
Sourcepub fn expected_number(actual: Value<NumericTypes>) -> Self
pub fn expected_number(actual: Value<NumericTypes>) -> Self
Constructs EvalexprError::ExpectedNumber{actual}.
Sourcepub fn expected_number_or_string(actual: Value<NumericTypes>) -> Self
pub fn expected_number_or_string(actual: Value<NumericTypes>) -> Self
Constructs EvalexprError::ExpectedNumberOrString{actual}.
Sourcepub fn expected_boolean(actual: Value<NumericTypes>) -> Self
pub fn expected_boolean(actual: Value<NumericTypes>) -> Self
Constructs EvalexprError::ExpectedBoolean{actual}.
Sourcepub fn expected_tuple(actual: Value<NumericTypes>) -> Self
pub fn expected_tuple(actual: Value<NumericTypes>) -> Self
Constructs EvalexprError::ExpectedTuple{actual}.
Sourcepub fn expected_fixed_len_tuple(
expected_len: usize,
actual: Value<NumericTypes>,
) -> Self
pub fn expected_fixed_len_tuple( expected_len: usize, actual: Value<NumericTypes>, ) -> Self
Constructs EvalexprError::ExpectedFixedLenTuple{expected_len, actual}.
Sourcepub fn expected_ranged_len_tuple(
expected_len: RangeInclusive<usize>,
actual: Value<NumericTypes>,
) -> Self
pub fn expected_ranged_len_tuple( expected_len: RangeInclusive<usize>, actual: Value<NumericTypes>, ) -> Self
Constructs EvalexprError::ExpectedFixedLenTuple{expected_len, actual}.
Sourcepub fn expected_empty(actual: Value<NumericTypes>) -> Self
pub fn expected_empty(actual: Value<NumericTypes>) -> Self
Constructs EvalexprError::ExpectedEmpty{actual}.
Sourcepub fn invalid_regex(regex: String, message: String) -> Self
pub fn invalid_regex(regex: String, message: String) -> Self
Constructs EvalexprError::InvalidRegex(regex)
Trait Implementations§
Source§impl<NumericTypes: Clone + EvalexprNumericTypes> Clone for EvalexprError<NumericTypes>
impl<NumericTypes: Clone + EvalexprNumericTypes> Clone for EvalexprError<NumericTypes>
Source§fn clone(&self) -> EvalexprError<NumericTypes>
fn clone(&self) -> EvalexprError<NumericTypes>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more