use std::str;
pub trait ToBytes {
fn to_bytes(&self) -> &[u8];
}
impl ToBytes for &str {
fn to_bytes(&self) -> &[u8] {
self.as_bytes()
}
}
impl ToBytes for String {
fn to_bytes(&self) -> &[u8] {
self.as_bytes()
}
}
impl<const N: usize> ToBytes for [u8; N] {
fn to_bytes(&self) -> &[u8] {
self
}
}
impl<'a, const N: usize> ToBytes for &'a [u8; N] {
fn to_bytes(&self) -> &[u8] {
#[allow(clippy::explicit_auto_deref)]
*self
}
}
impl ToBytes for &[u8] {
fn to_bytes(&self) -> &[u8] {
self
}
}
impl ToBytes for Vec<u8> {
fn to_bytes(&self) -> &[u8] {
self
}
}