1 unstable release
Uses old Rust 2015
0.1.0 | Dec 4, 2018 |
---|
#25 in #month
4KB
56 lines
re-parse
Implements FromStr
for a struct using Regex
and serde_urlencoded
.
Usage
#[derive(Debug, Eq, PartialEq, PartialOrd, Ord, Deserialize, ReParse)]
#[re_parse(regex=r#"(?x)
\[
(?P<year>[0-9]{4})-(?P<month>[0-9]{2})-(?P<day>[0-9]{2})
\s+
(?P<hour>[0-9]{2}):(?P<minute>[0-9]{2})
\]
"#)]
struct DateTime {
year: u32,
month: u32,
day: u32,
hour: u32,
minute: u32,
}
fn main() {
let x: DateTime = "[1518-11-01 00:00]".parse().unwrap();
println!("{:?}", &x);
}
Dependencies
~7MB
~153K SLoC