Struct restructure::Restruct
[−]
[src]
pub struct Restruct;
Contains the fill
method used to fill the struct with fields
Methods
impl Restruct
[src]
fn fill<T: RegexStruct>(regex_struct: &T, text: &str) -> T
This function takes a RegexStruct
and a Slice
and returns a RegexStruct
with its fields filled with
the patterns from the text
regexify! ( Details { name, String, r"\w+" _w, String, r"\s+" age, i32, r"\d+" }); let user: Details = Default::default(); let obama = Restruct::fill(&user, "Obama 54"); assert_eq!("Obama", obama.name); assert_eq!(54, obama.age);