Update mod.rs

This commit is contained in:
michael-bailey 2020-07-17 20:52:10 +01:00
parent b62d32dcd5
commit 8981f5c551
1 changed files with 7 additions and 0 deletions

View File

@ -206,6 +206,13 @@ impl From<String> for Commands {
} }
} }
impl From<&[u8]> for Commands {
fn from(data: &[u8]) -> Self {
let incoming_message = String::from(String::from_utf8_lossy(data)).as_str();
Commands::from(incoming_message)
}
}
#[cfg(test)] #[cfg(test)]
mod test_commands_v2 { mod test_commands_v2 {
use super::Commands; use super::Commands;