#[non_exhaustive]
pub enum EvalexprError {
Show 34 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, UnmatchedDoubleQuote, MissingOperatorOutsideOfBrace, 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), BuiltinFunctionsCannotBeEnabled, BuiltinFunctionsCannotBeDisabled, CustomMessage(String),
}
Expand description

Errors used in this crate.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

WrongOperatorArgumentAmount

Fields

§expected: usize

The expected amount of arguments.

§actual: usize

The actual amount of arguments.

An operator was called with a wrong amount of arguments.

§

WrongFunctionArgumentAmount

Fields

§expected: usize

The expected amount of arguments.

§actual: usize

The actual amount of arguments.

A function was called with a wrong amount of arguments.

§

ExpectedString

Fields

§actual: Value

The actual value.

A string value was expected.

§

ExpectedInt

Fields

§actual: Value

The actual value.

An integer value was expected.

§

ExpectedFloat

Fields

§actual: Value

The actual value.

A float value was expected.

§

ExpectedNumber

Fields

§actual: Value

The actual value.

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

§

ExpectedNumberOrString

Fields

§actual: Value

The actual value.

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

§

ExpectedBoolean

Fields

§actual: Value

The actual value.

A boolean value was expected.

§

ExpectedTuple

Fields

§actual: Value

The actual value.

A tuple value was expected.

§

ExpectedFixedLenTuple

Fields

§expected_len: usize

The expected len

§actual: Value

The actual value.

A tuple value of a certain length was expected.

§

ExpectedEmpty

Fields

§actual: Value

The actual value.

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

Fields

§expected: Vec<ValueType>

The expected types.

§actual: Value

The actual value.

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

Fields

§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.

An operator is used with a wrong combination of types.

§

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

Fields

§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.

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.

§

AdditionError

Fields

§augend: Value

The first argument of the addition.

§addend: Value

The second argument of the addition.

An addition operation performed by Rust failed.

§

SubtractionError

Fields

§minuend: Value

The first argument of the subtraction.

§subtrahend: Value

The second argument of the subtraction.

A subtraction operation performed by Rust failed.

§

NegationError

Fields

§argument: Value

The argument of the negation.

A negation operation performed by Rust failed.

§

MultiplicationError

Fields

§multiplicand: Value

The first argument of the multiplication.

§multiplier: Value

The second argument of the multiplication.

A multiplication operation performed by Rust failed.

§

DivisionError

Fields

§dividend: Value

The first argument of the division.

§divisor: Value

The second argument of the division.

A division operation performed by Rust failed.

§

ModulationError

Fields

§dividend: Value

The first argument of the modulation.

§divisor: Value

The second argument of the modulation.

A modulation operation performed by Rust failed.

§

InvalidRegex

Fields

§regex: String

The invalid regular expression

§message: String

Failure message from the regex engine

A regular expression could not be parsed

§

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.

§

CustomMessage(String)

A custom error explained by its message.

Implementations§

source§

impl EvalexprError

source

pub fn type_error(actual: Value, expected: Vec<ValueType>) -> Self

Constructs EvalexprError::TypeError{actual, expected}.

source

pub fn wrong_type_combination( operator: Operator, actual: Vec<ValueType> ) -> Self

Constructs EvalexprError::WrongTypeCombination{operator, actual}.

source

pub fn expected_string(actual: Value) -> Self

Constructs EvalexprError::ExpectedString{actual}.

source

pub fn expected_int(actual: Value) -> Self

Constructs EvalexprError::ExpectedInt{actual}.

source

pub fn expected_float(actual: Value) -> Self

Constructs EvalexprError::ExpectedFloat{actual}.

source

pub fn expected_number(actual: Value) -> Self

Constructs EvalexprError::ExpectedNumber{actual}.

source

pub fn expected_number_or_string(actual: Value) -> Self

Constructs EvalexprError::ExpectedNumberOrString{actual}.

source

pub fn expected_boolean(actual: Value) -> Self

Constructs EvalexprError::ExpectedBoolean{actual}.

source

pub fn expected_tuple(actual: Value) -> Self

Constructs EvalexprError::ExpectedTuple{actual}.

source

pub fn expected_fixed_len_tuple(expected_len: usize, actual: Value) -> Self

Constructs EvalexprError::ExpectedFixedLenTuple{expected_len, actual}.

source

pub fn expected_empty(actual: Value) -> Self

Constructs EvalexprError::ExpectedEmpty{actual}.

source

pub fn invalid_regex(regex: String, message: String) -> Self

Constructs EvalexprError::InvalidRegex(regex)

Trait Implementations§

source§

impl Clone for EvalexprError

source§

fn clone(&self) -> EvalexprError

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for EvalexprError

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for EvalexprError

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Error for EvalexprError

1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

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

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl PartialEq<EvalexprError> for EvalexprError

source§

fn eq(&self, other: &EvalexprError) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for EvalexprError

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<E> Provider for Ewhere E: Error + ?Sized,

source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.