You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ContentDeserializer does not support 128-bit integers, which causes issues when attempting to use some features with formats that support 128-bit numbers. The following tag/rename pattern fails using serde_cbor and ciborium, which accept i128-bit types, returning ErrorImpl { code: Message("i128 is not supported"), offset: 0 }.
#[test]fnbug(){#[derive(serde::Deserialize, serde::Serialize)]structFoo{message:String,}#[derive(serde::Deserialize, serde::Serialize)]structBar{value:i128,}#[derive(serde::Deserialize, serde::Serialize)]#[serde(tag = "ty")]enumMyEnum{#[serde(rename = "foo")]Foo(Foo),#[serde(rename = "bar")]Bar(Bar),}// this works (decode MyEnum::Foo){let v = MyEnum::Foo(Foo{message:"hello, world!".to_owned(),});let encoded = serde_cbor::to_vec(&v).unwrap();let decoded:MyEnum = serde_cbor::from_slice(&encoded).unwrap();match decoded {MyEnum::Foo(v) => assert_eq!(&v.message, "hello, world!"),
_ => assert!(false),}}// this works (decode Bar directly){let v = MyEnum::Bar(Bar{value:12345678901234567890,});let encoded = serde_cbor::to_vec(&v).unwrap();let decoded:Bar = serde_cbor::from_slice(&encoded).unwrap();assert_eq!(decoded.value, 12345678901234567890);}// this fails (decode MyEnum::Bar), i128 not supported{let v = MyEnum::Bar(Bar{value:12345678901234567890,});let encoded = serde_cbor::to_vec(&v).unwrap();let decoded:MyEnum = serde_cbor::from_slice(&encoded).unwrap();match decoded {MyEnum::Bar(v) => assert_eq!(v.value, 12345678901234567890),
_ => assert!(false),}}}
The text was updated successfully, but these errors were encountered:
ContentDeserializer
does not support 128-bit integers, which causes issues when attempting to use some features with formats that support 128-bit numbers. The followingtag
/rename
pattern fails usingserde_cbor
andciborium
, which accept i128-bit types, returningErrorImpl { code: Message("i128 is not supported"), offset: 0 }
.The text was updated successfully, but these errors were encountered: