rusticata_macros/lib.rs
1//! # Rusticata-macros
2//!
3//! Helper macros for the [rusticata](https://github.com/rusticata) project.
4//!
5//! This crate contains some additions to [nom](https://github.com/Geal/nom).
6//!
7//! For example, the [`combinator::cond_else`] function allows to apply the first parser if the
8//! condition is true, and the second if the condition is false:
9//!
10//! ```rust
11//! # use nom::IResult;
12//! # use nom::combinator::map;
13//! # use nom::number::streaming::*;
14//! use rusticata_macros::combinator::cond_else;
15//! # fn parser(s:&[u8]) {
16//! let r: IResult<_, _, ()> = cond_else(
17//! || s.len() > 1,
18//! be_u16,
19//! map(be_u8, u16::from)
20//! )(s);
21//! # }
22//! ```
23//!
24//! See the documentation for more details and examples.
25
26#![deny(
27 missing_docs,
28 unsafe_code,
29 unstable_features,
30 unused_import_braces,
31 unused_qualifications
32)]
33#![cfg_attr(not(feature = "std"), no_std)]
34// only enables the `doc_cfg` feature when
35// the `docsrs` configuration attribute is defined
36#![cfg_attr(docsrs, feature(doc_auto_cfg))]
37
38extern crate alloc;
39pub mod combinator;
40pub mod debug;
41pub use macros::*;
42#[macro_use]
43pub mod macros;
44
45mod traits;
46pub use traits::*;
47
48// re-exports
49pub use nom;