Skip to main content

write_value_with

Function write_value_with 

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

Appends value to out in the given Format.

ยงExamples

use jsonx_lib::{write_value_with, Format};

let mut out = String::from("data: ");
write_value_with(&mut out, &[1, 2], Format::pretty().with_indent(0));
assert_eq!(out, "data: [\n1,\n2\n]");