[][src]Struct manger::ConsumeError

pub struct ConsumeError { /* fields omitted */ }

A list of errors that occured while consuming from a source.

Implementations

impl ConsumeError[src]

pub fn new() -> ConsumeError[src]

Create a new empty ConsumeError.

pub fn new_with(cause: ConsumeErrorType) -> ConsumeError[src]

Create a new ConsumeError containing only cause.

pub fn new_from(causes: Vec<ConsumeErrorType>) -> ConsumeError[src]

Create a new ConsumeError containing causes.

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

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

Examples

use manger::{ ConsumeError, ConsumeErrorType::* };
assert_eq!(
    ConsumeError::new_from(
        vec![
            InvalidValue { index: 0 },
            InsufficientTokens { index: 5 }
        ]
    ).offset(2),
    ConsumeError::new_from(
        vec![
            InvalidValue { index: 2 },
            InsufficientTokens { index: 7 }
        ]
    )
);

pub fn into_causes(self) -> Vec<ConsumeErrorType>[src]

Fetch a vector of the causes of this error.

This consume ownership of the error.

pub fn causes(&self) -> Vec<&ConsumeErrorType>[src]

Fetch a vector of references to the causes of this error.

pub fn add_cause(&mut self, cause: ConsumeErrorType)[src]

Pushes an extra cause for this error.

pub fn add_causes(&mut self, other_err: ConsumeError)[src]

Pushes all the causes for other_err for this error.

Trait Implementations

impl Debug for ConsumeError[src]

impl PartialEq<ConsumeError> for ConsumeError[src]

impl StructuralPartialEq for ConsumeError[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, 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.