Open
Description
💡 Feature description
Currently the code generated by #[derive(Recap)]
doesn't seem to be able to be composed in any manner. Ideally, I would more or less expect that fields of types with #[derive(Recap)]
ought to be able to be parsed just like primitives and builtin types.
💻 Basic example
#[derive(Debug, Deserialize, Recap)]
#[recap(regex = r#"(?P<quantity>\d+) (?P<name>\w+)"#)]
struct Chemical {
quantity: u32,
name: String,
}
#[derive(Debug, Deserialize, Recap)]
#[recap(regex = r#"(?P<inner>\d+ \w+)"#)]
struct Wrapper {
inner: Chemical,
}
fn main() {
// ok
"1 FUEL".parse::<Chemical>().unwrap();
// Err(Custom("invalid type: string "1 FUEL", expected struct Chemical"))
"1 FUEL".parse::<Wrapper>().unwrap();
}
Metadata
Assignees
Labels
No labels