1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
//! # Canonical Encoding Rules /// Attempts to decode `T` from `input` using CER. pub fn decode<T: crate::Decode>(input: &[u8]) -> Result<T, crate::ber::de::Error> { T::decode(&mut crate::ber::de::Decoder::new( input, crate::ber::de::DecoderOptions::cer(), )) } /// Attempts to encode `value` to CER. pub fn encode<T: crate::Encode>(value: &T) -> Result<alloc::vec::Vec<u8>, crate::ber::enc::Error> { let mut enc = crate::ber::enc::Encoder::new(crate::ber::enc::EncoderOptions::cer()); value.encode(&mut enc)?; Ok(enc.output) }