tinytemplate

Function format

Source
pub fn format(value: &Value, output: &mut String) -> Result<()>
Expand description

The format function is used as the default value formatter for all values unless the user specifies another. It is provided publicly so that it can be called as part of custom formatters. Values are formatted as follows:

  • Value::Null => the empty string
  • Value::Bool => true|false
  • Value::Number => the number, as formatted by serde_json.
  • Value::String => the string, HTML-escaped

Arrays and objects are not formatted, and attempting to do so will result in a rendering error.