Canonicalize a JSON value into its RFC-8785 string form.
(value: &Value)
| 121 | |
| 122 | /// Canonicalize a JSON value into its RFC-8785 string form. |
| 123 | pub fn canonicalize(value: &Value) -> String { |
| 124 | // Infallible for a `Value`: there is no writer to fail against, every |
| 125 | // member name is already a Rust `String`, and the delegate's only other |
| 126 | // error path is a non-finite float, which `Value` cannot hold. This mirrors |
| 127 | // the expectation the hand-written string helper carried before it. |
| 128 | serde_json_canonicalizer::to_string(value).expect("canonicalizing a Value is infallible") |
| 129 | } |
| 130 | |
| 131 | #[cfg(test)] |
| 132 | mod tests { |
no outgoing calls