pub struct Writer { /* private fields */ }Expand description
Writer that builds TOON output string from JSON values.
Implementations§
Source§impl Writer
impl Writer
Sourcepub fn new(options: EncodeOptions) -> Self
pub fn new(options: EncodeOptions) -> Self
Create a new writer with the given options.
pub fn write_str(&mut self, s: &str) -> ToonResult<()>
pub fn write_char(&mut self, ch: char) -> ToonResult<()>
pub fn write_newline(&mut self) -> ToonResult<()>
pub fn write_indent(&mut self, depth: usize) -> ToonResult<()>
pub fn write_delimiter(&mut self) -> ToonResult<()>
pub fn write_key(&mut self, key: &str) -> ToonResult<()>
Sourcepub fn write_array_header(
&mut self,
key: Option<&str>,
length: usize,
fields: Option<&[String]>,
depth: usize,
) -> ToonResult<()>
pub fn write_array_header( &mut self, key: Option<&str>, length: usize, fields: Option<&[String]>, depth: usize, ) -> ToonResult<()>
Write an array header with key, length, and optional field list.
Sourcepub fn write_empty_array_with_key(
&mut self,
key: Option<&str>,
) -> ToonResult<()>
pub fn write_empty_array_with_key( &mut self, key: Option<&str>, ) -> ToonResult<()>
Write an empty array header.
pub fn needs_quoting(&self, s: &str, context: QuotingContext) -> bool
pub fn write_quoted_string(&mut self, s: &str) -> ToonResult<()>
pub fn write_value( &mut self, s: &str, context: QuotingContext, ) -> ToonResult<()>
pub fn push_active_delimiter(&mut self, delim: Delimiter)
pub fn pop_active_delimiter(&mut self)
Auto Trait Implementations§
impl Freeze for Writer
impl RefUnwindSafe for Writer
impl Send for Writer
impl Sync for Writer
impl Unpin for Writer
impl UnwindSafe for Writer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more