Macro standalone_syn::call [] [src]

macro_rules! call {
    ($i:expr, $fun:expr $(, $args:expr)*) => { ... };
}

Invoke the given parser function with zero or more arguments.

  • Syntax: call!(FN, ARGS...)

    where the signature of the function is fn(Cursor, ARGS...) -> PResult<T>

  • Output: T, the result of invoking the function FN

#[macro_use]
extern crate syn;

use syn::Type;
use syn::punctuated::Punctuated;
use syn::synom::Synom;

/// Parses one or more Rust types separated by commas.
///
/// Example: `String, Vec<T>, [u8; LEN + 1]`
struct CommaSeparatedTypes {
    types: Punctuated<Type, Token![,]>,
}

impl Synom for CommaSeparatedTypes {
    named!(parse -> Self, do_parse!(
        types: call!(Punctuated::parse_separated_nonempty) >>
        (CommaSeparatedTypes { types })
    ));
}

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