Skip to main content

write_value

Function write_value 

Source
pub fn write_value<T: ToJson + ?Sized>(out: &mut String, value: &T)
Expand description

Appends value to out as compact JSON (see to_string). Reusing one buffer across documents avoids an allocation per document.

ยงExamples

use jsonx_lib::{json, write_value};

let mut out = String::from("Content: ");
write_value(&mut out, &json!([true]));
assert_eq!(out, "Content: [true]");