From 6c89f341518d4edaa60009b7f819e88f70c736d8 Mon Sep 17 00:00:00 2001 From: michael-bailey Date: Tue, 16 Mar 2021 10:11:03 +0000 Subject: [PATCH] added from vector trait to commands --- src/lib/commands/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/commands/mod.rs b/src/lib/commands/mod.rs index a4a50a2..6d88eee 100644 --- a/src/lib/commands/mod.rs +++ b/src/lib/commands/mod.rs @@ -230,6 +230,14 @@ impl From<&mut [u8; 1024]> for Commands { } } +impl From<&mut Vec> for Commands { + fn from(data: &mut Vec) -> Self { + let incoming_message = String::from(String::from_utf8_lossy(data)); + data.zeroize(); + Commands::from(incoming_message) + } +} + // TODO: check if unit tests still work /*#[cfg(test)] mod test_commands_v2 {