Added a Message-consuming Into<Result<Command>> for ergonomics.

This commit is contained in:
Aaron Weiss 2015-06-16 16:05:28 -04:00
parent 83c38931bf
commit f2e8f37877

View file

@ -348,6 +348,12 @@ fn string(s: &'static str) -> String {
s.to_owned() s.to_owned()
} }
impl From<Message> for Result<Command> {
fn from(m: Message) -> Result<Command> {
(&m).into()
}
}
impl<'a> From<&'a Message> for Result<Command> { impl<'a> From<&'a Message> for Result<Command> {
/// Converts a Message into a Command. /// Converts a Message into a Command.
fn from(m: &'a Message) -> Result<Command> { fn from(m: &'a Message) -> Result<Command> {