diff --git a/src/utils/byte_name.rs b/src/utils/bytes_name.rs similarity index 58% rename from src/utils/byte_name.rs rename to src/utils/bytes_name.rs index df818f8..4dedf56 100644 --- a/src/utils/byte_name.rs +++ b/src/utils/bytes_name.rs @@ -1,22 +1,20 @@ -use bytes::{Buf, Bytes}; - pub trait BytesName { - type Output: Buf; + type Output; fn to_byte_name(self) -> Self::Output; fn to_ascii_lowercase_byte_name(self) -> Self::Output; } impl> BytesName for T { - type Output = Bytes; + type Output = Vec; fn to_byte_name(self) -> Self::Output { - let b = self.into().bytes().collect::>(); - Bytes::from(b) + self.into().bytes().collect::>() + // Bytes::from(b) } fn to_ascii_lowercase_byte_name(self) -> Self::Output { - let b = self.into().bytes().collect::>().to_ascii_lowercase(); - Bytes::from(b) + self.into().bytes().collect::>().to_ascii_lowercase() + // Bytes::from(b) } } @@ -29,7 +27,7 @@ mod tests { let bn = s.to_byte_name(); let bn_lc = s.to_ascii_lowercase_byte_name(); - assert_eq!(Bytes::from(s.as_bytes()), bn); - assert_eq!(Bytes::from("ok_string"), bn_lc); + assert_eq!(Vec::from(s.as_bytes()), bn); + assert_eq!(Vec::from("ok_string"), bn_lc); } } diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 256c294..bdc2381 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,4 +1,4 @@ -mod byte_name; +mod bytes_name; mod socket_addr; pub use socket_addr::ToCanonical;