Devolutions / Devolutions/mongodm-rs

field! macro can't deal with Enum.

Open
#25 0 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
Rust
Stars
36
Forks
11
PR merge metrics
No merged PRs in 30d

Description

```rust
#[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
```json
{ "e": { "A": { "f": "field string" } } }
```
However, we can't build the path "e.A.f" with `field!` macro now.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.