-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
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),
}
}
}
Metadata
Metadata
Assignees
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.