pub fn encode(packet: Packet<'_>) -> Result<Vec<u8>, PacketError>
Host-side encoding with the same shape checks as the borrowed decoder.