Closed
Description
I'm not sure if this is an oversight. But the implementation should be trivial. I'll add tests and implement it, if it is fine.
enum ParseCharError { EmptyString, TooManyChars }
impl FromStr for char {
type Err = ParseCharError;
#[inline]
fn from_str(s: &str) -> Result<char, ParseCharError> {
match s.len() {
0 => Err(ParseCharError::EmptyString),
1 => Ok(s[0]),
_ => Err(ParseCharError::TooManyChars),
}
}
}