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