pub trait WriteToBytes { fn write_to_bytes(&self, bytes: &mut Vec); fn into_bytes(&self) -> Vec { let mut bytes = Vec::new(); self.write_to_bytes(&mut bytes); bytes } }