Skip to main content

format_val

Macro format_val 

Source
macro_rules! format_val {
    ($w:ident, $pp:ident, $level:expr, $v:ident, $f:expr) => { ... };
}
Expand description

Write a value as JSON superset, using a function $f to write sub-values.

This macro writes strings by replacing invalid UTF-8 characters with the Unicode replacement character. That way, this macro can be used not only for writers, but also for formatters, which require all output to be valid UTF-8. However, the JSON/YAML writers usually override this behaviour, yielding invalid UTF-8 characters as-is.