Created
August 22, 2020 23:05
-
-
Save rockerBOO/ced1c074461531a1cea1b1a6eef87f46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl From<&str> for Person { | |
fn from(s: &str) -> Person { | |
match s.split(",").collect() { | |
[age, name] => Person { | |
age | |
name | |
}, | |
_ -> Person::default() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment