-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Description
I had the weirdest bug ever. I took me 3 hours to narrow down the source below is a minimal example of the error
./src/main.rs
#[macro_use]
extern crate serde_derive;
use serde;
use serde_json;
use serde::{Serialize, Deserialize};
#[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)]
enum Data {
Integer(u64),
Pair(String, String),
}
fn main() {
let w = Data::Integer(1);
let w_str = serde_json::to_string(&w).unwrap();
println!("{:?}", w_str);
let w_deser = serde_json::from_str::<Data>(&w_str).unwrap();
println!("{:?}", w_deser);
}
Cargo.toml
[package]
name = "test"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
path = "src/main.rs"
name = "main"
[dependencies]
serde = "1.0.124"
serde_derive = "1.0.124"
serde_json = "1.0.64"
When adding tracing-bunyan-formatter = "0.1.7"
to dependenies main throws an error. Tested also with "0.2.0".
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("data did not match any variant of untagged enum Data", line: 0, column: 0)', src/main.rs:19:56
EDIT: Just noticed this issue #3
dbanty, Stranger6667 and seanpianka
Metadata
Metadata
Assignees
Labels
No labels