Closed
Description
This nightly feature (#74773) makes it easy to parse key-value pairs or lists.
I could have used this method recently but required the matching character as well. Problematically it would have used a predicate pattern for finding one of several characters. To retrieve it separately is quite awkward with lots of index logic and some unwrap. Should there be a set of alternative method (or this method changed) that returns the separator as well? I'd implement that new set or change the existing methods but wanted to have some feedback on the idea first.
Rough draft of code I wanted to use:
let key_value: &str = _;
if let Some((lhs, sep, rhs)) = key_value.split_once(|ch| ch == '=' || ch == ':') {
// handle
}
cc: @matklad