pub trait ToJsonExt: ToJson {
// Provided methods
fn to_fixed_buf<const N: usize>(&self) -> Option<FixedBuf<N>> { ... }
fn json_write_reuse<'a>(&self, buf: &'a mut Vec<u8>) -> &'a [u8] ⓘ { ... }
fn json_write_io(&self, w: impl Write) -> Result<()> { ... }
}Expand description
Extension trait adding stack-buffer and reuse helpers for every T: ToJson.
Provided Methods§
Sourcefn to_fixed_buf<const N: usize>(&self) -> Option<FixedBuf<N>>
fn to_fixed_buf<const N: usize>(&self) -> Option<FixedBuf<N>>
Serialize into a stack-allocated FixedBuf<N>. Returns None if output exceeds N.
Sourcefn json_write_reuse<'a>(&self, buf: &'a mut Vec<u8>) -> &'a [u8] ⓘ
fn json_write_reuse<'a>(&self, buf: &'a mut Vec<u8>) -> &'a [u8] ⓘ
Serialize to a pre-allocated Vec<u8>, clearing it first (amortizes allocation).
Sourcefn json_write_io(&self, w: impl Write) -> Result<()>
fn json_write_io(&self, w: impl Write) -> Result<()>
Serialize to any io::Write.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".