// equals the json: {"address": "127.0.0.1:80", "tls": {}}
let input = r#"
address: 127.0.0.1:80
tls:
"#;
let endpoint: Endpoint = serde_yaml::from_str(input).unwrap();
println!("endpoint: {:?}", endpoint);
// will print: Endpoint { address: "127.0.0.1:80", tls: None }
My expected value is the tls field should be Some( ClientTLS: {crt: None, key: None, sni: None} ) like the behavior of serde_json, but it seems decoded as None.
I have an
Endpoint
struct following the codes below:I'm trying to parse from a blank
tls
field:My expected value is the
tls
field should beSome( ClientTLS: {crt: None, key: None, sni: None} )
like the behavior ofserde_json
, but it seems decoded as None.How to fix my codes to return the expected value?