From c453a88c998999a2b9b7dcfa365435df6f2857f5 Mon Sep 17 00:00:00 2001 From: Hubert Date: Sun, 10 Jul 2022 22:14:40 +0200 Subject: [PATCH] loosen api requirements (#8) --- wakey/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wakey/src/lib.rs b/wakey/src/lib.rs index c289ba6..515ae4c 100644 --- a/wakey/src/lib.rs +++ b/wakey/src/lib.rs @@ -47,7 +47,7 @@ impl WolPacket { /// ``` /// # Panic /// Panics when input MAC is invalid (i.e. contains non-byte characters) - pub fn from_string(data: &str, sep: char) -> WolPacket { + pub fn from_string>(data: T, sep: char) -> WolPacket { WolPacket::from_bytes(&WolPacket::mac_to_byte(data, sep)) } @@ -91,8 +91,9 @@ impl WolPacket { /// Converts string representation of MAC address (e.x. 00:01:02:03:04:05) to raw bytes. /// # Panic /// Panics when input MAC is invalid (i.e. contains non-byte characters) - fn mac_to_byte(data: &str, sep: char) -> ArrayVec { + fn mac_to_byte>(data: T, sep: char) -> ArrayVec { let bytes = data + .as_ref() .split(sep) .flat_map(|x| hex::decode(x).expect("Invalid mac!")) .collect::>();