pub fn to_string<T: ToJson + ?Sized>(value: &T) -> Result<String, Error>Expand description
Serialize value into a fresh String.
Returns Error (rather than Infallible) so non-finite floats and
other typed-level failures have a place to surface.
Internally serializes into a Vec<u8> via ByteSink (avoiding
per-byte UTF-8 invariant checks), then converts to String in one
step. The resulting bytes are guaranteed valid UTF-8 because every
JsonWrite method only emits ASCII structural bytes, &str slices
(valid by construction), ASCII escape sequences, and ASCII digit
sequences from the integer/float formatters.