simd_json::prelude::generator

Trait BaseGenerator

Source
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<(), Error>; // Provided methods fn write(&mut self, slice: &[u8]) -> Result<(), Error> { ... } fn write_char(&mut self, ch: u8) -> Result<(), Error> { ... } fn new_line(&mut self) -> Result<(), Error> { ... } fn indent(&mut self) { ... } fn dedent(&mut self) { ... } fn write_string(&mut self, string: &str) -> Result<(), Error> { ... } fn write_string_content(&mut self, string: &str) -> Result<(), Error> { ... } fn write_simple_string(&mut self, string: &str) -> Result<(), Error> { ... } fn write_simple_str_content(&mut self, string: &str) -> Result<(), Error> { ... } fn write_float(&mut self, num: f64) -> Result<(), Error> { ... } fn write_int<I>(&mut self, num: I) -> Result<(), Error> where I: Integer { ... } unsafe fn write_str_simd(&mut self, string: &mut &[u8]) -> Result<(), Error> { ... }
}
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<(), Error>

write with minimum

§Errors

if the write fails

Provided Methods§

Source

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

Write a slice

§Errors

if the write fails

Source

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

Write a char

§Errors

if the write fails

Source

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

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<(), Error>

writes a string

§Errors

if the write fails

Source

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

writes a string

§Errors

if the write fails

Source

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

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<(), Error>

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<(), Error>

writes a float value

§Errors

if the write fails

Source

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

writes an integer value

§Errors

if the write fails

Source

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

§Safety

This function is unsafe because it may use simd instructions

§Errors

if the write fails

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§