Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shenqingyi9 opened this issue Apr 30, 2023 · 0 comments
Open

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

shenqingyi9 opened this issue Apr 30, 2023 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@shenqingyi9
Copy link

#[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.

@CBenoit CBenoit added enhancement New feature or request help wanted Extra attention is needed labels Apr 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Development

No branches or pull requests

2 participants