Skip to content

0.8.8

Compare
Choose a tag to compare
@maciejhirsz maciejhirsz released this 10 Jul 10:07
· 145 commits to master since this release

This is a patch release that adds a take_string method to JsonValue:


Checks that self is a string, returns an owned Rust String, leaving
Null in it's place.

This is the cheapest way to obtain an owned String from JSON, as no
extra heap allocation is performend.

let mut data = array!["Hello", "World"];

let owned = data[0].take_string().expect("Should be a string");

assert_eq!(owned, "Hello");
assert!(data[0].is_null());