1234#[macro_export]5macro_rules! bondrewd_codec {6 ($T:ty) => {7 impl Encode for $T {8 fn encode_to<O: codec::Output + ?Sized>(&self, dest: &mut O) {9 dest.write(&self.into_bytes())10 }11 }12 impl codec::Decode for $T {13 fn decode<I: codec::Input + ?Sized>(from: &mut I) -> Result<Self, codec::Error> {14 let mut bytes = [0; Self::BYTE_SIZE];15 from.read(&mut bytes)?;16 Ok(Self::from_bytes(bytes))17 }18 }19 impl MaxEncodedLen for $T {20 fn max_encoded_len() -> usize {21 Self::BYTE_SIZE22 }23 }24 impl TypeInfo for $T {25 type Identity = [u8; Self::BYTE_SIZE];26 fn type_info() -> scale_info::Type {27 <[u8; Self::BYTE_SIZE] as TypeInfo>::type_info()28 }29 }30 };31}