Skip to content

field! macro can't deal with Enum. #25

@shenqingyi9

Description

@shenqingyi9
#[derive(Serialize, Deserialize)]
struct Foo {
    e: E,
}

#[derive(Serialize, Deserialize)]
enum E {
    A(Foo1)
}

#[derive(Serialize, Deserialize)]
struct Foo1 {
    f: String,
}

let f = Foo {
    e: E::A(Foo1 {
        f: "field string".to_string(),
    }),
};
println!("{}", bson::to_document(&f).unwrap());

Here we get a result

{ "e": { "A": { "f": "field string" } } }

However, we can't build the path "e.A.f" with field! macro now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions