7 releases (2 stable)

1.1.0 Jun 17, 2020
1.0.0 Jun 11, 2020
0.4.0 Jun 3, 2019
0.3.1 Oct 11, 2018
0.1.0 Feb 9, 2018

#115 in Encoding

Download history 178195/week @ 2024-11-18 151643/week @ 2024-11-25 185955/week @ 2024-12-02 183800/week @ 2024-12-09 176307/week @ 2024-12-16 66271/week @ 2024-12-23 75219/week @ 2024-12-30 164028/week @ 2025-01-06 185598/week @ 2025-01-13 175288/week @ 2025-01-20 182486/week @ 2025-01-27 193910/week @ 2025-02-03 201618/week @ 2025-02-10 179910/week @ 2025-02-17 190698/week @ 2025-02-24 195070/week @ 2025-03-03

774,097 downloads per month
Used in 364 crates (98 directly)

MIT/Apache

18KB
440 lines

Serde Regex

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.

Example

#[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,
}

License

Licensed under either of

Contribution

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.

Dependencies

~2.1–3.5MB
~60K SLoC