pub fn emit(
value: Value,
format: Format,
pretty: bool,
null_as: Option<&str>,
) -> Result<String>Expand description
Converts the merged IR into format and serializes it.
null_as substitutes a string for every null rather than failing on one.
It is honoured in the TOML arm and nowhere else: JSON can hold a null
perfectly well, so there is nothing there for it to rescue and substituting
anyway would corrupt a document that was never in trouble.
Both arms can fail, and each fails on what its own format cannot spell:
value::to_toml on nulls, integers past i64::MAX and malformed datetimes,
value::to_json on infinities and NaNs. The two sets do not overlap, so each
format is the escape from the other’s rejection — which is the help the CLI
appends, and the reason neither library error names a flag. Both report key
paths alone: nothing about the inputs survives the merge for them to name.