Skip to content

A serde wrapper that allows to (de)serialize regular expressions

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
Unknown
LICENSE-MIT
Notifications You must be signed in to change notification settings

dvtomas/serde-regex

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A serde wrapper that allows to (de)serialize regular expressions

Resources

License

Apache-2.0, Unknown licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
Unknown
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%