pub trait BaseGenerator {
    type T: Write;

Show 14 methods // Required methods fn get_writer(&mut self) -> &mut Self::T; fn write_min(&mut self, slice: &[u8], min: u8) -> Result<()>; // Provided methods fn write(&mut self, slice: &[u8]) -> Result<()> { ... } fn write_char(&mut self, ch: u8) -> Result<()> { ... } fn new_line(&mut self) -> Result<()> { ... } fn indent(&mut self) { ... } fn dedent(&mut self) { ... } fn write_string(&mut self, string: &str) -> Result<()> { ... } fn write_string_content(&mut self, string: &str) -> Result<()> { ... } fn write_simple_string(&mut self, string: &str) -> Result<()> { ... } fn write_simple_str_content(&mut self, string: &str) -> Result<()> { ... } fn write_float(&mut self, num: f64) -> Result<()> { ... } fn write_int<I: Integer>(&mut self, num: I) -> Result<()> { ... } unsafe fn write_str_simd(&mut self, string: &mut &[u8]) -> Result<()> { ... }
}
Expand description

Base generator trait

Required Associated Types§

source

type T: Write

The writer

Required Methods§

source

fn get_writer(&mut self) -> &mut Self::T

returns the writer

source

fn write_min(&mut self, slice: &[u8], min: u8) -> Result<()>

write with minimum

Errors

if the write fails

Provided Methods§

source

fn write(&mut self, slice: &[u8]) -> Result<()>

Write a slice

Errors

if the write fails

source

fn write_char(&mut self, ch: u8) -> Result<()>

Write a char

Errors

if the write fails

source

fn new_line(&mut self) -> Result<()>

writes new line

Errors

if the write fails

source

fn indent(&mut self)

indents one step

source

fn dedent(&mut self)

dedents one step

source

fn write_string(&mut self, string: &str) -> Result<()>

writes a string

Errors

if the write fails

source

fn write_string_content(&mut self, string: &str) -> Result<()>

writes a string

Errors

if the write fails

source

fn write_simple_string(&mut self, string: &str) -> Result<()>

writes a simple string (usually short and non escaped) This means we can skip the simd accelerated writing which is expensive on short strings.

Errors

if the write fails

source

fn write_simple_str_content(&mut self, string: &str) -> Result<()>

writes a simple string content (usually short and non escaped) This means we can skip the simd accelerated writing which is expensive on short strings.

Errors

if the write fails

source

fn write_float(&mut self, num: f64) -> Result<()>

writes a float value

Errors

if the write fails

source

fn write_int<I: Integer>(&mut self, num: I) -> Result<()>

writes an integer value

Errors

if the write fails

source

unsafe fn write_str_simd(&mut self, string: &mut &[u8]) -> Result<()>

Safety

This function is unsafe because it may use simd instructions

Errors

if the write fails

Object Safety§

This trait is not object safe.

Implementors§

source§

impl BaseGenerator for DumpGenerator

§

type T = Vec<u8>

source§

impl BaseGenerator for PrettyGenerator

§

type T = Vec<u8>

source§

impl<'w, W> BaseGenerator for PrettyWriterGenerator<'w, W>
where W: Write,

§

type T = W

source§

impl<'w, W> BaseGenerator for WriterGenerator<'w, W>
where W: Write,

§

type T = W