[no description]
impls
| -rw-r--r-- | src/lib.rs | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -18,9 +18,20 @@ pub trait ToK { type K; fn to_key(&self) -> Self::K; } -impl<T: Clone> ToK for T { - type K = T; +macro_rules! primitive { + ($($t:ty)+) => { $( + impl ToK for $t { + type K = Self; + fn to_key(&self) -> Self::K { + *self + } + } + )+ }; +} +primitive!(i8 i16 i32 i64 i128 u8 u16 u32 u64 u128); +impl<T: Clone> ToK for Vec<T> { + type K = Self; fn to_key(&self) -> Self::K { self.clone() } |