| Crates.io | regex_with |
| lib.rs | regex_with |
| version | 0.1.1 |
| created_at | 2024-07-13 15:05:00.625641+00 |
| updated_at | 2024-07-13 15:10:20.850999+00 |
| description | A Rust library providing procedural macros for regex-based parsing and validation of custom data types. |
| homepage | |
| repository | https://github.com/yamaura/regex_with |
| max_upload_size | |
| id | 1302404 |
| size | 5,078 |
The regex_with library provides Rust procedural macros to enable regex-based parsing capabilities for custom types. It simplifies the integration of regex patterns into the parsing process of data structures.
use regex_with::{Capturable, de::FromStr};
#[derive(serde::Deserialize, Capturable, FromStr)]
#[regex_with(re = "^(?P<id>\\d+)$")]
struct Record {
id: u32,
}
let record: Record = "123".parse().unwrap();
assert_eq!(record.id, 123);