Last active
February 4, 2019 06:29
-
-
Save srishanbhattarai/99af0104353a549d95b30ab3cad1470a to your computer and use it in GitHub Desktop.
Messages.rs for the Neovim Plugin blog
This file contains hidden or 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
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