[][src]Enum evalexpr::error::Error

pub enum Error {
    WrongOperatorArgumentAmount {
        expected: usize,
        actual: usize,
    },
    WrongFunctionArgumentAmount {
        expected: usize,
        actual: usize,
    },
    ExpectedString {
        actual: Value,
    },
    ExpectedInt {
        actual: Value,
    },
    ExpectedFloat {
        actual: Value,
    },
    ExpectedNumber {
        actual: Value,
    },
    ExpectedBoolean {
        actual: Value,
    },
    ExpectedTuple {
        actual: Value,
    },
    EmptyExpression,
    EvaluatedRootNode,
    AppendedToLeafNode,
    PrecedenceViolation,
    VariableIdentifierNotFound(String),
    FunctionIdentifierNotFound(String),
    TypeError {
        expected: Vec<Value>,
        actual: Value,
    },
    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,
    },
}

Errors used in this crate.

Variants

WrongOperatorArgumentAmount

An operator was called with a wrong amount of arguments.

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.

Fields of WrongFunctionArgumentAmount

expected: usize

The expected amount of arguments.

actual: usize

The actual amount of arguments.

ExpectedString

A string value was expected.

Fields of ExpectedString

actual: Value

The actual value.

ExpectedInt

An integer value was expected.

Fields of ExpectedInt

actual: Value

The actual value.

ExpectedFloat

A float value was expected.

Fields of ExpectedFloat

actual: Value

The actual value.

ExpectedNumber

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

Fields of ExpectedNumber

actual: Value

The actual value.

ExpectedBoolean

A boolean value was expected.

Fields of ExpectedBoolean

actual: Value

The actual value.

ExpectedTuple

A tuple value was expected.

Fields of ExpectedTuple

actual: Value

The actual value.

EmptyExpression

The given expression is empty

EvaluatedRootNode

Tried to evaluate the root node. The root node should only be used as dummy node.

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.

VariableIdentifierNotFound(String)

A VariableIdentifier operation did not find its value in the configuration.

FunctionIdentifierNotFound(String)

A FunctionIdentifier operation did not find its value in the configuration.

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.

Fields of TypeError

expected: Vec<Value>

The expected types.

actual: Value

The actual value.

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.

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.

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.

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.

Fields of NegationError

argument: Value

The argument of the negation.

MultiplicationError

A multiplication operation performed by Rust failed.

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.

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.

Fields of ModulationError

dividend: Value

The first argument of the modulation.

divisor: Value

The second argument of the modulation.

Methods

impl Error[src]

pub fn type_error(actual: Value, expected: Vec<Value>) -> Self[src]

Constructs Error::TypeError{actual, expected}.

pub fn expected_string(actual: Value) -> Self[src]

Constructs Error::ExpectedString(actual).

pub fn expected_int(actual: Value) -> Self[src]

Constructs Error::ExpectedInt(actual).

pub fn expected_float(actual: Value) -> Self[src]

Constructs Error::ExpectedFloat(actual).

pub fn expected_number(actual: Value) -> Self[src]

Constructs Error::ExpectedNumber(actual).

pub fn expected_boolean(actual: Value) -> Self[src]

Constructs Error::ExpectedBoolean(actual).

pub fn expected_tuple(actual: Value) -> Self[src]

Constructs Error::ExpectedTuple(actual).

Trait Implementations

impl PartialEq<Error> for Error[src]

impl Debug for Error[src]

Auto Trait Implementations

impl Send for Error

impl Sync for Error

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.