combine::error

Trait StreamError

Source
pub trait StreamError<Item, Range>: Sized + PartialEq {
Show 18 methods // Required methods fn unexpected_token(token: Item) -> Self; fn unexpected_range(token: Range) -> Self; fn unexpected_message<T>(msg: T) -> Self where T: Display; fn expected_token(token: Item) -> Self; fn expected_range(token: Range) -> Self; fn expected_message<T>(msg: T) -> Self where T: Display; fn message_token(token: Item) -> Self; fn message_range(token: Range) -> Self; fn message_message<T>(msg: T) -> Self where T: Display; fn into_other<T>(self) -> T where T: StreamError<Item, Range>; // Provided methods fn unexpected(info: Info<Item, Range>) -> Self { ... } fn unexpected_static_message(msg: &'static str) -> Self { ... } fn expected(info: Info<Item, Range>) -> Self { ... } fn expected_static_message(msg: &'static str) -> Self { ... } fn message_static_message(msg: &'static str) -> Self { ... } fn message(info: Info<Item, Range>) -> Self { ... } fn other<E>(err: E) -> Self where E: StdError + Send + Sync + 'static { ... } fn end_of_input() -> Self { ... }
}
Expand description

StreamError represents a single error returned from a Stream or a Parser.

Usually multiple instances of StreamError is composed into a ParseError to build the final error value.

Required Methods§

Source

fn unexpected_token(token: Item) -> Self

Source

fn unexpected_range(token: Range) -> Self

Source

fn unexpected_message<T>(msg: T) -> Self
where T: Display,

Source

fn expected_token(token: Item) -> Self

Source

fn expected_range(token: Range) -> Self

Source

fn expected_message<T>(msg: T) -> Self
where T: Display,

Source

fn message_token(token: Item) -> Self

Source

fn message_range(token: Range) -> Self

Source

fn message_message<T>(msg: T) -> Self
where T: Display,

Source

fn into_other<T>(self) -> T
where T: StreamError<Item, Range>,

Converts self into a different StreamError type.

This should aim to preserve as much information as possible into the returned T value but if Self ignores some information passed to it using one of the constructors that information is naturally lost.

Provided Methods§

Source

fn unexpected(info: Info<Item, Range>) -> Self

Source

fn unexpected_static_message(msg: &'static str) -> Self

Source

fn expected(info: Info<Item, Range>) -> Self

Source

fn expected_static_message(msg: &'static str) -> Self

Source

fn message_static_message(msg: &'static str) -> Self

Source

fn message(info: Info<Item, Range>) -> Self

Source

fn other<E>(err: E) -> Self
where E: StdError + Send + Sync + 'static,

Source

fn end_of_input() -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Item, Range> StreamError<Item, Range> for Error<Item, Range>
where Item: PartialEq, Range: PartialEq,

Source§

impl<Item, Range> StreamError<Item, Range> for StringStreamError

Source§

impl<Item, Range> StreamError<Item, Range> for UnexpectedParse