Skip to content

Instantly share code, notes, and snippets.

@srishanbhattarai
Last active February 4, 2019 06:29
Show Gist options
  • Save srishanbhattarai/99af0104353a549d95b30ab3cad1470a to your computer and use it in GitHub Desktop.
Save srishanbhattarai/99af0104353a549d95b30ab3cad1470a to your computer and use it in GitHub Desktop.
Messages.rs for the Neovim Plugin blog
enum Messages {
Add,
Multiply,
Unknown(String),
}
impl From<String> for Messages {
fn from(event: String) -> Self {
match &event[..] {
"add" => Messages::Add,
"multiply" => Messages::Multiply,
_ => Messages::Unknown(event),
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment