[][src]Enum manger::ConsumeErrorType

pub enum ConsumeErrorType {
    InsufficientTokens {
        index: usize,
    },
    UnexpectedToken {
        index: usize,
        token: char,
    },
    InvalidValue {
        index: usize,
    },
}

One item in ConsumeError. these can occur while consuming from a `source.

Multiple instances of this type can occur during one parsing. Especially, multiple instance of these error occur, when using enum's or using the Either<L, R> struct.

Variants

InsufficientTokens

An error varient which occurs when while consuming more tokens where expected, but none were found.

Fields of InsufficientTokens

index: usize

The utf-8 character index within the source at which more tokens were expected, but not found.

UnexpectedToken

An error varient which occurs when while consuming a token that was not expected is presented.

Fields of UnexpectedToken

index: usize

The utf-8 character index within the source at which an unexpected token was found.

token: char

The utf-8 character which was unexpected.

InvalidValue

An error varient which occurs when while consuming a consume condition is not met.

This happens most often when a condition is specified for consumation, but it is not met. However, this also happens when a integer or float overflows tries to assume an incorrect value.

Fields of InvalidValue

index: usize

The utf-8 character index within the source at which an invalid value started to be formed.

Implementations

impl ConsumeErrorType[src]

pub fn index(&self) -> &usize[src]

Fetch the utf-8 character index at which a consume error occured.

pub fn offset(self, by: usize) -> Self[src]

Mutate self to move the utf-8 character index at which they were caused by by.

Examples

use manger::ConsumeErrorType::*;
assert_eq!(
    InvalidValue { index: 0 }.offset(2),
    InvalidValue { index: 2 },
);

Trait Implementations

impl Clone for ConsumeErrorType[src]

impl Copy for ConsumeErrorType[src]

impl Debug for ConsumeErrorType[src]

impl Display for ConsumeErrorType[src]

impl Error for ConsumeErrorType[src]

impl PartialEq<ConsumeErrorType> for ConsumeErrorType[src]

impl StructuralPartialEq for ConsumeErrorType[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.