Macro syn::many0 [] [src]

macro_rules! many0 {
    ($i:expr, $submac:ident!( $($args:tt)* )) => { ... };
    ($i:expr, $f:expr) => { ... };
}

Parse zero or more values using the given parser.

You may also be looking for:

#[macro_use]
extern crate syn;

use syn::{Ident, Item};
use syn::token::Brace;
use syn::synom::Synom;

/// Parses a module containing zero or more Rust items.
///
/// Example: `mod m { type Result<T> = ::std::result::Result<T, MyError>; }`
struct SimpleMod {
    mod_token: Token![mod],
    name: Ident,
    brace_token: Brace,
    items: Vec<Item>,
}

impl Synom for SimpleMod {
    named!(parse -> Self, do_parse!(
        mod_token: keyword!(mod) >>
        name: syn!(Ident) >>
        body: braces!(many0!(syn!(Item))) >>
        (SimpleMod {
            mod_token,
            name,
            brace_token: body.0,
            items: body.1,
        })
    ));
}

This macro is available if Syn is built with the "parsing" feature.