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
{{ message }}
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.
Hi, I'm having trouble de-serializing i128 when it is in a tagged enum. Here's a MWE of the bug. Any ideas why this might happen? Am I doing something wrong? It works when I replace the i128 with a i64.
$ cargo run
Error: i128 is not supported
main.rs
use indoc::indoc;use anyhow::Result;use serde::Deserialize;#[derive(Clone,Debug,Deserialize)]pubstructIntegerType<T>{pubvalue:T,}#[derive(Clone,Debug,Deserialize)]#[serde(tag = "type")]pubenumType{// replacing i128/u128 by i64/u64 works#[serde(rename(deserialize = "signed"))]Signed(IntegerType<i128>),#[serde(rename(deserialize = "unsigned"))]Unsigned(IntegerType<u128>),}fnmain() -> Result<()>{let yaml = indoc!{" type: signed value: 123 "};let yaml:Type = serde_yaml::from_str(yaml)?;println!("{:#?}", yaml);Ok(())}
Cargo.lock
[package]
name = "test-serde-yaml"version = "0.1.0"edition = "2021"
[dependencies]
anyhow = "1"indoc = "2"serde_yaml = "0.9"serde = { version = "1", features = ["derive"] }
The text was updated successfully, but these errors were encountered:
gpollo
changed the title
Fail to deserialize i128 in this scenario
Fail to deserialize i128 in tagged enum
Oct 11, 2023
gpollo
changed the title
Fail to deserialize i128 in tagged enum
Fail to deserialize i128 in internally tagged enum
Oct 11, 2023
Hi, I'm having trouble de-serializing i128 when it is in a tagged enum. Here's a MWE of the bug. Any ideas why this might happen? Am I doing something wrong? It works when I replace the
i128
with ai64
.main.rs
Cargo.lock
The text was updated successfully, but these errors were encountered: