substrate-data 0.3.1

One data model, text syntax, binary form, packed frames and schema system — for any program's files, saves and wire messages.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! A whole [`Value`] as text.

use super::Writer;
use crate::model::value::Value;

/// `value` as compact text (typed values in their string forms).
pub fn to_string(value: &Value) -> String {
    let mut w = Writer::new();
    w.value(value);
    w.finish()
}

/// `value` as text indented by two spaces, one entry per line.
pub fn to_string_pretty(value: &Value) -> String {
    let mut w = Writer::pretty();
    w.value(value);
    w.finish()
}