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 Dec 17, 2024. It is now read-only.
Can anybody explain, why deserialize tokens don't match the serialized one (Token::Some is missed)? For me that seems as an error, because non-flatten option can't be deserialized in the same manner:
use serde::Deserialize;use serde_test::{assert_de_tokens,Token};#[derive(Debug,PartialEq,Deserialize)]structOuter{#[serde(flatten)]inner:Inner,}#[derive(Debug,PartialEq,Deserialize)]structInner{option:Option<u64>,}/// Failed with/// tokens failed to deserialize: invalid type: integer `2`, expected option#[test]fnordinal(){assert_de_tokens(&Inner{option:Some(2),},&[Token::Map{len:None},Token::Str("option"),Token::U64(2),Token::MapEnd,],);}/// Success (!?)#[test]fnflatten(){assert_de_tokens(&Outer{inner:Inner{option:Some(2),},},&[Token::Map{len:None},Token::Str("option"),Token::U64(2),Token::MapEnd,],);}