JsonWrite

Trait JsonWrite 

Source
pub trait JsonWrite {
    // Required methods
    fn write(&mut self, buf: &[u8]);
    fn reserve(&mut self, additional: usize);
}
Expand description

Re-export the Write trait from facet-core for backwards compatibility.

This trait is used by the JSON serializer to write output without depending on std::io::Write, enabling no_std support. A no_std compatible write trait used by facet serializers.

This trait provides a simple interface for writing bytes, designed to work in no_std environments while remaining compatible with standard library types.

Required Methods§

Source

fn write(&mut self, buf: &[u8])

Write all bytes from the buffer to the writer.

Source

fn reserve(&mut self, additional: usize)

If the writer supports it, reserve space for additional bytes.

This is an optimization hint and may be ignored by implementations.

Implementations on Foreign Types§

Source§

impl Write for &mut Vec<u8>

Available on crate feature alloc only.
Source§

fn write(&mut self, buf: &[u8])

Source§

fn reserve(&mut self, additional: usize)

Source§

impl Write for Vec<u8>

Available on crate feature alloc only.
Source§

fn write(&mut self, buf: &[u8])

Source§

fn reserve(&mut self, additional: usize)

Implementors§