Open nuno1212s opened 7 months ago
Bincode version: 2.0.0-rc3
I'm facing an issue when using bincode's serde facing serialization/deserialization with simple Enums. Namely I always get UnexpectedEnd { additional: 1 } error when trying to decode the enum.
The enum in question:
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] pub enum MessageModule { Reconfiguration, Protocol, StateProtocol, Application, }
The unit test used to verify this behaviour:
#[test] pub fn test_message_mod_serialization() -> Result<()> { let msg_mod = MessageModule::Protocol; let vec = bincode::serde::encode_to_vec(&msg_mod, bincode::config::standard())?; let mod_bytes = Bytes::from(vec); println!("Mod bytes {:x?}", mod_bytes); let (de_ser_msg_mod, msg_mod_size): (MessageModule, usize) = bincode::serde::decode_borrowed_from_slice(mod_bytes.as_ref(), bincode::config::standard())?; assert_eq!(de_ser_msg_mod, msg_mod); Ok(()) }
Bytes::from is using the bytes crate.
Expected behaviour: The decoded message module should match the encoded one. Observed behaviour: Error: UnexpectedEnd { additional: 1 }
I am experiencing the same issue, is there any workaround?
Bincode version: 2.0.0-rc3
I'm facing an issue when using bincode's serde facing serialization/deserialization with simple Enums. Namely I always get UnexpectedEnd { additional: 1 } error when trying to decode the enum.
The enum in question:
The unit test used to verify this behaviour:
Bytes::from is using the bytes crate.
Expected behaviour: The decoded message module should match the encoded one. Observed behaviour: Error: UnexpectedEnd { additional: 1 }