pub struct Restruct;
Expand description
Contains the fill
method used to fill the struct with fields
Implementations§
Source§impl Restruct
impl Restruct
Sourcepub fn fill<T: RegexStruct>(regex_struct: &T, text: &str) -> T
pub 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);
Auto Trait Implementations§
impl Freeze for Restruct
impl RefUnwindSafe for Restruct
impl Send for Restruct
impl Sync for Restruct
impl Unpin for Restruct
impl UnwindSafe for Restruct
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more