| //! # 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 [`cond_else`] function allows to apply the first parser if the |
| //! condition is true, and the second if the condition is false: |
| //! |
| //! ```rust |
| //! # use nom::IResult; |
| //! # use nom::combinator::map; |
| //! # use nom::number::streaming::*; |
| //! use rusticata_macros::combinator::cond_else; |
| //! # fn parser(s:&[u8]) { |
| //! let r: IResult<_, _, ()> = cond_else( |
| //! || s.len() > 1, |
| //! be_u16, |
| //! map(be_u8, u16::from) |
| //! )(s); |
| //! # } |
| //! ``` |
| //! |
| //! See the documentation for more details and examples. |
| |
| #![deny( |
| missing_docs, |
| unsafe_code, |
| unstable_features, |
| unused_import_braces, |
| unused_qualifications |
| )] |
| |
| 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::*; |