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 was archived by the owner on Jan 29, 2023. It is now read-only.
#[derive(Debug,Deserialize)]
enum RoleType {
Admin,
User,
VipUser,
}
#[derive(Debug, Deserialize)]
struct User {
name: String,
age: u8,
weight: u8,
high: f32,
#[serde(flatten)]
role_type:RoleType
}
#[test]
fn test01() {
let s = r#"{
name="yancheng"
age=28
weight=76
high=1.77
role_type="VipUser"
}"#;
let user: User = hocon::de::from_str(s).unwrap();
println!("{:?}", user)
}
called `Result::unwrap()` on an `Err` value: Deserialization { message: ".: no variant of enum RoleType found in flattened data" }
thread 'test01' panicked at 'called `Result::unwrap()` on an `Err` value: Deserialization { message: ".: no variant of enum RoleType found in flattened data" }', examples\hocon_test01.rs:50:45
stack backtrace:
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: