Macro syn::reject [] [src]

macro_rules! reject {
    ($i:expr,) => { ... };
}

Unconditionally fail to parse anything.

This may be useful in rejecting some arms of a switch! parser.

#[macro_use]
extern crate syn;

use syn::Item;

// Parse any item, except for a module.
named!(almost_any_item -> Item,
    switch!(syn!(Item),
        Item::Mod(_) => reject!()
        |
        ok => value!(ok)
    )
);

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