| Crates.io | de-regex |
| lib.rs | de-regex |
| version | 0.1.0 |
| created_at | 2021-04-29 10:18:39.170475+00 |
| updated_at | 2021-04-29 10:18:39.170475+00 |
| description | Regular expression based deserialization for serde |
| homepage | |
| repository | https://github.com/vstroebel/de-regex |
| max_upload_size | |
| id | 390976 |
| size | 31,651 |
This crate contains a library that deserializes a string into a struct based on a regular expression and serde.
use serde::Deserialize;
#[derive(Deserialize)]
struct Dimensions {
width: u32,
height: u32
}
let pattern = r"^(?P<width>\d+)x(?P<height>\d+)$";
let input = "800x600";
let dim: Dimensions = de_regex::from_str(input, pattern).unwrap();
assert_eq!(dim.width, 800);
assert_eq!(dim.height, 600);
This project is licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in serde_urlencoded by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.