rotty / lexpr-rs

Rust Lisp expression parser and serializer
Apache License 2.0
164 stars 24 forks source link

serde nested struct? #69

Closed jestarray closed 3 years ago

jestarray commented 3 years ago

i cant seem to deserialize a nested struct.. e.g

    #[derive(Debug, Serialize, Deserialize)]
    #[serde(rename_all = "kebab-case")]
    struct Person {
        first_name: String,
        address: Address,
    }
    #[derive(Debug, Serialize, Deserialize)]
    #[serde(rename_all = "kebab-case")]
    struct Address {
        street_name: String,
        apt_num: u32,
    }
    let person: Person = from_str(
        "((first-name . \"Bob\") (address . ((apt-num . 3) (street-name . \"1234 Rose Bvld\"))))",
    )
    .unwrap();

the corresponding s-expression is: ((first_name . "Bob") (address . ((street_name . "1234 Rose Bvld") (apartment_num . 3)))) is there no support for nested structs or am i doing something wrong?

jestarray commented 3 years ago

nevermind, they do work