Skip to content

Commit

Permalink
Add surprise example
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Oct 11, 2024
1 parent 218edea commit 260731c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions merde/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ name = "ahash"
path = "examples/ahash.rs"
required-features = ["json", "ahash"]

[[example]]
name = "surprise"
path = "examples/surprise.rs"
required-features = ["json"]

[dependencies]
merde_core = { version = "7.0.0", path = "../merde_core", optional = true }
merde_json = { version = "6.2.1", path = "../merde_json", optional = true }
Expand Down
17 changes: 17 additions & 0 deletions merde/examples/surprise.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use merde::Value;

struct Person {
first_name: String,
last_name: String,
}

merde::derive! {
impl (Deserialize) for struct Person { first_name, last_name }
}

fn main() {
let input = "[".repeat(10_000);

let value: Value<'static> = merde::json::from_str_owned(&input[..]).unwrap();
eprintln!("value: {:?}", value);
}

0 comments on commit 260731c

Please sign in to comment.