Skip to content

deserialize and serialize do not appear to be symmetric? #114

@starpit

Description

@starpit

In the following example code, when I deserialize (A 3 4), I get the expected Hello::A((3,4)). When i serialize it back to a string, I get (A . #(3 4)). The asymmetry seems odd? Not shown in the code, but when I deserialize that serialized string, I do get round-tripped back to Hello::A((3,4)). So the full serde cycle is healthy, but the half cycles seems strange?

#[derive(Debug, PartialEq, serde::Deserialize, serde::Serialize)]
enum Hello {
    A((usize,usize)) 
}

fn main() {
    let x: Hello = serde_lexpr::from_str("(A 3 4)").unwrap();
    assert_eq!(x, Hello::A((3,4)));

    println!("{}", serde_lexpr::to_string(&x).unwrap());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions