ct_regex/demo.rs
1//! A demonstration of the types produced by the `regex!` macro.
2//!
3//! The [`Email`] and [`EmailCapture`] types have both been implemented by the following code:
4//!
5//! ```
6//! regex! {
7//! pub Email = r"(\w+)@(?<domain>(\w+)(\.\w+)?)"
8//! }
9//! ```
10//!
11//! Notable features include:
12//! - A fully expanded 'matcher' type expression under
13//! [`Email::Pattern`](struct.Email.html#associatedtype.Pattern-1), used to call a set of associated
14//! methods and perform the compile time matching.
15//! - Numbered and named captures generated specfic to the regular expression.
16//! - Optional and essential captures use [`Option`] as required.
17//! - Lazily sliced capture groups.
18
19use ct_regex_macro::regex;
20
21regex! {
22 pub Email = r"(\w+)@(?<domain>(\w+)(\.\w+)?)"
23}