#![allow(dead_code)] /// A buffer based on `Vec`. Writing to the buffer /// appends data to the vector pub struct VecBuf(pub Vec); impl udigest::encoding::Buffer for VecBuf { fn write(&mut self, bytes: &[u8]) { self.0.extend_from_slice(bytes) } } /// Encodes digestable data into bytes pub fn encode_to_vec(x: &impl udigest::Digestable) -> Vec { let mut buffer = VecBuf(vec![]); x.unambiguously_encode(udigest::encoding::EncodeValue::new(&mut buffer)); buffer.0 }