usher
usher copied to clipboard
Provide a trait to enable dynamic collection of captures into a custom type
Currently all captures are Vec<(&str, (usize, usize))>
. This is probably the most efficient way we can go by default, but it's not particularly friendly for those who need to then change this type into something else (e.g. HashMap<&str, String>
. It would be better if we could go directly into that type at capture time.
This would avoid an unnecessary Vec
allocation, and save a few cycles for the actual parsing. It is likely also easier for the developer to provide the trait implementation, rather than manually parsing out their values.