-
-
Notifications
You must be signed in to change notification settings - Fork 238
Open
Description
What version of the csv crate are you using?
version = "1.1.6"
Briefly describe the question, bug or feature request.
The program panics when serializing a struct that contains a nested struct decorated by #[serde(flatten)].
I am not sure whether this is a bug or expected behavior but I would expect the program to output a csv.
If it is expected are there any alternatives to obtain the desired output (without removing nesting) ?
Include a complete program demonstrating a problem.
use serde::Serialize;
fn main() {
let mut w = csv::Writer::from_writer(std::io::stdout());
w.serialize(Message::default()).unwrap();
}
#[derive(Serialize, Default)]
struct Message {
content: String,
#[serde(flatten)]
to: Person,
}
#[derive(Serialize, Default)]
struct Person {
name: String,
}What is the observed behavior of the code above?
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Serialize("serializing maps is not supported, if you have a use case, please file an issue at https://github.com/BurntSushi/rust-csv"))', src/main.rs:5:37
note: run with `RUST_BACKTRACE=1` environment variable to display a backtraceWhat is the expected or desired behavior of the code above?
content,name
,
497e0bdf29873, dzmitry-lahoda, Callaghan-Hattingh, pali6, nagisa and 3 more
Metadata
Metadata
Assignees
Labels
No labels