-
Notifications
You must be signed in to change notification settings - Fork 494
Closed
Labels
Description
The Match::as_str takes &self, so it can't be directly mapped onto the Option<Match<'t>> returned by get and name. A version consuming the Match would be more convenient for the purpose. And standard conversion From/Into seem to fit here.
Basically, code that used captures.name("foo") now needs to use captures.name("foo").as_ref().map(Match::as_str) or captures.name("foo").map(|m| m.as_str()). With Into, it should be able to use captures.name("foo").map(From::from).
Some code can be changed to use Match directly, but anything that wants to continue with something like .unwrap_or("") needs to convert to string.
Also note that Index does not seem to fit the bill, because code that needs Option can't use that.
Reactions are currently unavailable