feat: completed solutions

This commit is contained in:
2026-03-23 03:36:33 -04:00
parent 2279bea6f1
commit f568c094cb
65 changed files with 424 additions and 139 deletions
+13 -1
View File
@@ -41,7 +41,19 @@ enum ParsePersonError {
impl FromStr for Person {
type Err = ParsePersonError;
fn from_str(s: &str) -> Result<Self, Self::Err> {}
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.split(",").collect::<Vec<&str>>().as_slice() {
[name, age] if (!name.is_empty()) => match age.parse::<u8>() {
Ok(age) => Ok(Person {
name: name.to_string(),
age,
}),
Err(err) => Err(ParsePersonError::ParseInt(err)),
},
["", _] => Err(ParsePersonError::NoName),
_ => Err(ParsePersonError::BadLen),
}
}
}
fn main() {