[][src]Enum synom::IResult

pub enum IResult<I, O> {
    Done(I, O),
    Error,
}

The result of a parser.

Variants

Done(I, O)

Parsing succeeded. The first field contains the rest of the unparsed data and the second field contains the parse result.

Error

Parsing failed.

Methods

impl<'a, O> IResult<&'a str, O>[src]

pub fn expect(self, name: &str) -> O[src]

Unwraps the result, asserting the the parse is complete. Panics with a message based on the given string if the parse failed or is incomplete.

extern crate syn;
#[macro_use] extern crate synom;

use syn::Ty;
use syn::parse::ty;

// One or more Rust types separated by commas.
named!(comma_separated_types -> Vec<Ty>,
    separated_nonempty_list!(punct!(","), ty)
);

fn main() {
    let input = "&str, Map<K, V>, String";

    let parsed = comma_separated_types(input).expect("comma-separated types");

    assert_eq!(parsed.len(), 3);
    println!("{:?}", parsed);
}

Trait Implementations

impl<I: Eq, O: Eq> Eq for IResult<I, O>[src]

impl<I: Clone, O: Clone> Clone for IResult<I, O>[src]

impl<I: PartialEq, O: PartialEq> PartialEq<IResult<I, O>> for IResult<I, O>[src]

impl<I: Debug, O: Debug> Debug for IResult<I, O>[src]

Auto Trait Implementations

impl<I, O> Send for IResult<I, O> where
    I: Send,
    O: Send

impl<I, O> Unpin for IResult<I, O> where
    I: Unpin,
    O: Unpin

impl<I, O> Sync for IResult<I, O> where
    I: Sync,
    O: Sync

impl<I, O> UnwindSafe for IResult<I, O> where
    I: UnwindSafe,
    O: UnwindSafe

impl<I, O> RefUnwindSafe for IResult<I, O> where
    I: RefUnwindSafe,
    O: RefUnwindSafe

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

impl<T> From<T> for 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.

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

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

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