#[impl_for_each]
Expand description
Repeat an implementation for each type with T
replaced
ยงExample
use impl_for::impl_for_each;
pub trait IntoBytes {
fn into_bytes(self) -> Vec<u8>;
}
#[impl_for_each(i8, u8, i16, u16, i32, u32, i64, isize, usize)]
impl IntoBytes for T {
fn into_bytes(self) -> Vec<u8> {
let mut buf = ::itoa::Buffer::new();
let s = buf.format(self);
s.as_bytes().to_vec()
}
}