Enum calc_lib::E

source ·
pub enum E {
Show 13 variants MissingLF, InvalidQuit, InvalidRecall, DivByZero(usize), ExpIsNotInt(usize), ExpDivByZero(usize), NotNonNegIntFact(usize), InvalidDec(usize), NotEnoughPrevResults(u8), InvalidAbs(usize), InvalidPar(usize), MissingTerm(usize), TrailingSyms(usize),
}
Expand description

The error that is returned when attempting to evaluate the input.

Variants§

§

MissingLF

The input was not terminated with a line feed.

§

InvalidQuit

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

§

InvalidRecall

The input began with an = but was otherwise syntactically invalid.

§

DivByZero(usize)

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

§

ExpIsNotInt(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.

§

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.

§

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(u8)

A recall expression was used to recall the i-th previous result, but there are fewer than i previous results 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 ).

§

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, or a parenthetical expression.

§

TrailingSyms(usize)

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

Trait Implementations§

source§

impl Clone for E

source§

fn clone(&self) -> E

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 E

source§

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

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

impl Display for E

source§

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

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

impl Copy for E

Auto Trait Implementations§

§

impl RefUnwindSafe for E

§

impl Send for E

§

impl Sync for E

§

impl Unpin for E

§

impl UnwindSafe for E

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> 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.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.