1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
//! # Rusticata-macros //! //! Helper macros for the [rusticata](https://github.com/rusticata) project. //! //! This crate contains some additions to [nom](https://github.com/Geal/nom). //! //! For example, the `error_if!` macro allows to test a condition and return an error from the parser if the condition //! fails: //! //! ```rust //! # extern crate rusticata_macros; //! # extern crate nom; //! # use nom::{do_parse, take, IResult}; //! # use nom::error::ErrorKind; //! # use nom::number::streaming::be_u8; //! use rusticata_macros::error_if; //! # fn parser(s:&[u8]) { //! let r : IResult<&[u8],()> = do_parse!( //! s, //! l: be_u8 >> //! error_if!(l < 4, ErrorKind::Verify) >> //! data: take!(l - 4) >> //! (()) //! ); //! # } //! ``` //! //! See the documentation for more details and examples. #![deny( missing_docs, unsafe_code, unstable_features, unused_import_braces, unused_qualifications )] #[macro_use] extern crate nom; extern crate core; pub mod combinator; pub use macros::*; #[macro_use] pub mod macros; pub mod debug; mod traits; pub use traits::*;