Skip to content

Instantly share code, notes, and snippets.

@andete
Created June 17, 2017 07:57
Show Gist options
  • Save andete/ee8e5c6e3e3f01ad63a41464b309dcdd to your computer and use it in GitHub Desktop.
Save andete/ee8e5c6e3e3f01ad63a41464b309dcdd to your computer and use it in GitHub Desktop.
impl FromStr for Lang {
type Err = Error;
fn from_str(s:&str) -> Result<Self> {
match s {
"nl" => Ok(Lang::Nl),
"en" => Ok(Lang::En),
o => Err(format!("Unsupported language: {}", o).into()),
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment