pub trait BytesPrimitives {
fn to_bytes(&self) -> Vec<u8>;
}
impl BytesPrimitives for u8 {
fn to_bytes(&self) -> Vec<u8> {
format!("{}", &self).into_bytes()
}
}
impl BytesPrimitives for u16 {
fn to_bytes(&self) -> Vec<u8> {
format!("{}", &self).into_bytes()
}
}
impl BytesPrimitives for u32 {
fn to_bytes(&self) -> Vec<u8> {
format!("{}", &self).into_bytes()
}
}
impl BytesPrimitives for u64 {
fn to_bytes(&self) -> Vec<u8> {
format!("{}", &self).into_bytes()
}
}
impl BytesPrimitives for i8 {
fn to_bytes(&self) -> Vec<u8> {
format!("{}", &self).into_bytes()
}
}
impl BytesPrimitives for i16 {
fn to_bytes(&self) -> Vec<u8> {
format!("{}", &self).into_bytes()
}
}
impl BytesPrimitives for i32 {
fn to_bytes(&self) -> Vec<u8> {
format!("{}", &self).into_bytes()
}
}
impl BytesPrimitives for i64 {
fn to_bytes(&self) -> Vec<u8> {
format!("{}", &self).into_bytes()
}
}
impl BytesPrimitives for f32 {
fn to_bytes(&self) -> Vec<u8> {
format!("{}", &self).into_bytes()
}
}
impl BytesPrimitives for f64 {
fn to_bytes(&self) -> Vec<u8> {
format!("{}", &self).into_bytes()
}
}
impl BytesPrimitives for usize {
fn to_bytes(&self) -> Vec<u8> {
format!("{}", &self).into_bytes()
}
}
impl BytesPrimitives for isize {
fn to_bytes(&self) -> Vec<u8> {
format!("{}", &self).into_bytes()
}
}