Enum LangErr

Source
#[non_exhaustive]
pub enum LangErr {
Show 19 variants InvalidQuit, InvalidStore, DivByZero(usize), ExpIsNotIntOrOneHalf(usize), ExpDivByZero(usize), ModZero(usize), ModIsNotInt(usize), NotNonNegIntFact(usize), InvalidDec(usize), NotEnoughPrevResults(usize), InvalidAbs(usize), InvalidPar(usize), InvalidRound(usize), MissingTerm(usize), SqrtDoesNotExist(usize), TrailingSyms(usize), InvalidRand(usize), RandInvalidArgs(usize), RandNoInts(usize),
}
Expand description

Error due to a language violation.

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

InvalidQuit

The input began with a q but had non-whitespace that followed it.

§

InvalidStore

The input began with an s but had non-whitespace that followed it.

§

DivByZero(usize)

A sub-expression in the input would have led to a division by zero.

§

ExpIsNotIntOrOneHalf(usize)

A sub-expression in the input would have led to a rational number that was not 0 or 1 to be raised to a non-integer power that is not (+/-) 1/2.

§

ExpDivByZero(usize)

A sub-expression in the input would have led to 0 being raised to a negative power which itself would have led to a division by zero.

§

ModZero(usize)

A sub-expression in the input would have led to a number modulo 0.

§

ModIsNotInt(usize)

A sub-expression in the input would have led to the mod of two expressions with at least one not being an integer.

§

NotNonNegIntFact(usize)

A sub-expression in the input would have led to a non-integer factorial or a negative integer factorial.

§

InvalidDec(usize)

The input contained a non-empty sequence of digits followed by . which was not followed by a non-empty sequence of digits.

§

NotEnoughPrevResults(usize)

A recall expression was used to recall the i-th most-recent stored result, but there are fewer than i stored where i ∈ {1, 2, 3, 4, 5, 6, 7, 8}.

§

InvalidAbs(usize)

The input did not contain a closing |.

§

InvalidPar(usize)

The input did not contain a closing ).

§

InvalidRound(usize)

The input contained an invalid round expression.

§

MissingTerm(usize)

A sub-expression in the input had a missing terminal expression where a terminal expression is a decimal literal expression, recall expression, absolute value expression, parenthetical expression, or round expression.

§

SqrtDoesNotExist(usize)

The expression that was passed to the square root does not have a solution in the field of rational numbers.

§

TrailingSyms(usize)

The input started with a valid expression but was immediately followed by symbols that could not be chained with the preceding expression.

§

InvalidRand(usize)

Available on crate feature rand only.

The input contained an invalid random expression.

§

RandInvalidArgs(usize)

Available on crate feature rand only.

Error when the second argument is less than first in the rand function.

§

RandNoInts(usize)

Available on crate feature rand only.

Error when there are no 64-bit integers in the interval passed to the random function.

Trait Implementations§

Source§

impl Debug for LangErr

Source§

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

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

impl Display for LangErr

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

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

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

Source§

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 T
where U: TryFrom<T>,

Source§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V