Enum evalexpr::error::EvalexprError[][src]

pub enum EvalexprError {
Show variants WrongOperatorArgumentAmount { expected: usize, actual: usize, }, WrongFunctionArgumentAmount { expected: usize, actual: usize, }, ExpectedString { actual: Value, }, ExpectedInt { actual: Value, }, ExpectedFloat { actual: Value, }, ExpectedNumber { actual: Value, }, ExpectedNumberOrString { actual: Value, }, ExpectedBoolean { actual: Value, }, ExpectedTuple { actual: Value, }, ExpectedFixedLenTuple { expected_len: usize, actual: Value, }, ExpectedEmpty { actual: Value, }, AppendedToLeafNode, PrecedenceViolation, VariableIdentifierNotFound(String), FunctionIdentifierNotFound(String), TypeError { expected: Vec<ValueType>, actual: Value, }, WrongTypeCombination { operator: Operator, actual: Vec<ValueType>, }, UnmatchedLBrace, UnmatchedRBrace, UnmatchedPartialToken { first: PartialToken, second: Option<PartialToken>, }, AdditionError { augend: Value, addend: Value, }, SubtractionError { minuend: Value, subtrahend: Value, }, NegationError { argument: Value, }, MultiplicationError { multiplicand: Value, multiplier: Value, }, DivisionError { dividend: Value, divisor: Value, }, ModulationError { dividend: Value, divisor: Value, }, InvalidRegex { regex: String, message: String, }, ContextNotMutable, IllegalEscapeSequence(String), CustomMessage(String),
}
Expand description

Errors used in this crate.

Variants

WrongOperatorArgumentAmount

An operator was called with a wrong amount of arguments.

Show fields

Fields of WrongOperatorArgumentAmount

expected: usize

The expected amount of arguments.

actual: usize

The actual amount of arguments.

WrongFunctionArgumentAmount

A function was called with a wrong amount of arguments.

Show fields

Fields of WrongFunctionArgumentAmount

expected: usize

The expected amount of arguments.

actual: usize

The actual amount of arguments.

ExpectedString

A string value was expected.

Show fields

Fields of ExpectedString

actual: Value

The actual value.

ExpectedInt

An integer value was expected.

Show fields

Fields of ExpectedInt

actual: Value

The actual value.

ExpectedFloat

A float value was expected.

Show fields

Fields of ExpectedFloat

actual: Value

The actual value.

ExpectedNumber

A numeric value was expected. Numeric values are the variants Value::Int and Value::Float.

Show fields

Fields of ExpectedNumber

actual: Value

The actual value.

ExpectedNumberOrString

A numeric or string value was expected. Numeric values are the variants Value::Int and Value::Float.

Show fields

Fields of ExpectedNumberOrString

actual: Value

The actual value.

ExpectedBoolean

A boolean value was expected.

Show fields

Fields of ExpectedBoolean

actual: Value

The actual value.

ExpectedTuple

A tuple value was expected.

Show fields

Fields of ExpectedTuple

actual: Value

The actual value.

ExpectedFixedLenTuple

A tuple value of a certain length was expected.

Show fields

Fields of ExpectedFixedLenTuple

expected_len: usize

The expected len

actual: Value

The actual value.

ExpectedEmpty

An empty value was expected.

Show fields

Fields of ExpectedEmpty

actual: Value

The actual value.

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.

Show fields

Fields of TypeError

expected: Vec<ValueType>

The expected types.

actual: Value

The actual value.

WrongTypeCombination

An operator is used with a wrong combination of types.

Show fields

Fields of WrongTypeCombination

operator: Operator

The operator that whose evaluation caused the error.

actual: Vec<ValueType>

The types that were used in the operator causing it to fail.

UnmatchedLBrace

An opening brace without a matching closing brace was found.

UnmatchedRBrace

A closing brace without a matching opening brace was found.

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.

Show fields

Fields of UnmatchedPartialToken

first: PartialToken

The unmatched partial token.

second: Option<PartialToken>

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.

Show fields

Fields of AdditionError

augend: Value

The first argument of the addition.

addend: Value

The second argument of the addition.

SubtractionError

A subtraction operation performed by Rust failed.

Show fields

Fields of SubtractionError

minuend: Value

The first argument of the subtraction.

subtrahend: Value

The second argument of the subtraction.

NegationError

A negation operation performed by Rust failed.

Show fields

Fields of NegationError

argument: Value

The argument of the negation.

MultiplicationError

A multiplication operation performed by Rust failed.

Show fields

Fields of MultiplicationError

multiplicand: Value

The first argument of the multiplication.

multiplier: Value

The second argument of the multiplication.

DivisionError

A division operation performed by Rust failed.

Show fields

Fields of DivisionError

dividend: Value

The first argument of the division.

divisor: Value

The second argument of the division.

ModulationError

A modulation operation performed by Rust failed.

Show fields

Fields of ModulationError

dividend: Value

The first argument of the modulation.

divisor: Value

The second argument of the modulation.

InvalidRegex

A regular expression could not be parsed

Show fields

Fields of InvalidRegex

regex: String

The invalid regular expression

message: String

Failure message from the regex engine

ContextNotMutable

A modification was attempted on a Context that does not allow modifications.

IllegalEscapeSequence(String)

An escape sequence within a string literal is illegal.

CustomMessage(String)

A custom error explained by its message.

Implementations

Constructs EvalexprError::TypeError{actual, expected}.

Constructs EvalexprError::WrongTypeCombination{operator, actual}.

Constructs EvalexprError::ExpectedString{actual}.

Constructs EvalexprError::ExpectedInt{actual}.

Constructs EvalexprError::ExpectedFloat{actual}.

Constructs EvalexprError::ExpectedNumber{actual}.

Constructs EvalexprError::ExpectedNumberOrString{actual}.

Constructs EvalexprError::ExpectedBoolean{actual}.

Constructs EvalexprError::ExpectedTuple{actual}.

Constructs EvalexprError::ExpectedFixedLenTuple{expected_len, actual}.

Constructs EvalexprError::ExpectedEmpty{actual}.

Constructs EvalexprError::InvalidRegex(regex)

Trait Implementations

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.