Enum syn::parse::IResult
[−]
[src]
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]
fn expect(self, name: &str) -> O
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, O> Debug for IResult<I, O> where
I: Debug,
O: Debug,
[src]
I: Debug,
O: Debug,
fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.
impl<I, O> Clone for IResult<I, O> where
I: Clone,
O: Clone,
[src]
I: Clone,
O: Clone,
fn clone(&self) -> IResult<I, O>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<I, O> Eq for IResult<I, O> where
I: Eq,
O: Eq,
[src]
I: Eq,
O: Eq,
impl<I, O> PartialEq<IResult<I, O>> for IResult<I, O> where
I: PartialEq<I>,
O: PartialEq<O>,
[src]
I: PartialEq<I>,
O: PartialEq<O>,