You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
deserialize named capture groups into typesafe structs
Recap is provides what envy provides for environment variables, for named capture groups. Named regex capture groups are like any other regex capture group but have the extra property that they are associated with name. i.e (?P<name-of-capture-group>some-pattern)
🤔 who is this for
You may find this crate useful for cases where your application needs to extract information from string input provided by a third party that has a loosely structured format.
A common usecase for this is when you are dealing with log file data that was not stored in a particular structured format like JSON, but rather in a format that can be represented with a pattern.
You may also find this useful parsing other loosely formatted data patterns.
This crate would be less appropriate for cases where your input is provided in a more structured format, like JSON.
I recommend using a crate like serde-json for those cases instead.
📦 install
Add the following to your Cargo.toml file.
[dependencies]
recap = "0.1"
🤸 usage
A typical recap usage looks like the following. Assuming your Rust program looks something like this...