Crates.io | serde_fancy_regex |
lib.rs | serde_fancy_regex |
version | 2.0.0 |
source | src |
created_at | 2023-09-14 14:50:03.352657 |
updated_at | 2023-09-14 14:50:03.352657 |
description | A fork of serde_regex that (de)serializes fancy_regex as strings |
homepage | https://github.com/ZJaume/serde-fancy-regex |
repository | https://github.com/ZJaume/serde-fancy-regex |
max_upload_size | |
id | 972736 |
size | 30,261 |
A fork from Serde Regex for fancy_regex
library.
Documentation | Github | Crate
A serde wrapper, that can be used to serialize regular expressions as strings. It's often useful to read regexes from configuration file.
Note: regex is read with default settings. So DoS attack is probably possible if reading regex from untrusted source. I.e. reading from config file is okay, reading from API request is not.
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_regex;
use regex::Regex;
#[derive(Serialize, Deserialize)]
struct Timestamps {
#[serde(with = "serde_regex")]
pattern: Regex,
}
Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.