blob: 390c40231775ecb9a4d675c983487308d67bba26 [file] [log] [blame] [view]
David Tolnay35161ff2016-09-03 11:33:15 -07001Nom parser for Rust items
2=========================
3
4Parse Rust structs and enums without a Syntex dependency, intended for use with
5[Macros 1.1](https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md).
6
7```toml
8[dependencies]
David Tolnay10a24ee2016-09-04 17:38:44 -07009item = "0.3"
David Tolnay35161ff2016-09-03 11:33:15 -070010```
11
12```rust
13extern crate item;
14
15let raw = "
David Tolnay99ef8c92016-09-04 11:31:37 -070016 #[derive(Debug, Clone, Eq, PartialEq)]
David Tolnay35161ff2016-09-03 11:33:15 -070017 pub struct Item {
18 pub ident: Ident,
David Tolnay99ef8c92016-09-04 11:31:37 -070019 pub vis: Visibility,
David Tolnay35161ff2016-09-03 11:33:15 -070020 pub attrs: Vec<Attribute>,
David Tolnay99ef8c92016-09-04 11:31:37 -070021 pub generics: Generics,
22 pub body: Body,
David Tolnay35161ff2016-09-03 11:33:15 -070023 }
24";
25
David Tolnay33505d72016-09-04 11:30:29 -070026let ast = item::parse(raw);
David Tolnay35161ff2016-09-03 11:33:15 -070027```
28
29## License
30
31Licensed under either of
32
33 * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
34 * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
35
36at your option.
37
38### Contribution
39
40Unless you explicitly state otherwise, any contribution intentionally submitted
41for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
42be dual licensed as above, without any additional terms or conditions.