Skip to content

Regular expression based deserialization for serde

License

Apache-2.0, MIT licenses found

Licenses found

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

vstroebel/de-regex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

De-Regex

docs.rs badge crates.io badge Rust

This crate contains a library that deserializes a string into a struct based on a regular expression and serde.

Example

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);

License

This project is licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in de-regexp by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Regular expression based deserialization for serde

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Languages