# Trait json::codegen::Generator [−] [src]

    pub trait Generator {
        type T: Write;
        fn get_writer(&mut self) -> &mut Self::T;
        fn write_min(&mut self, slice: &[u8], min: u8) -> Result<()>;

        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_complex(&mut self, string: &str, start: usize) -> Result<()> { ... }
        fn write_string(&mut self, string: &str) -> Result<()> { ... }
        fn write_number(&mut self, num: &Number) -> Result<()> { ... }
        fn write_object(&mut self, object: &Object) -> Result<()> { ... }
        fn write_json(&mut self, json: &JsonValue) -> Result<()> { ... }
    }

Default trait for serializing JSONValue into string.

## Associated Types

### `type T: Write` [src]

Loading content...

## Required methods

### `fn get_writer(&mut self) -> &mut Self::T` [src]

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

Loading content...

## Provided methods

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

### `fn write_char(&mut self, ch: u8) -> Result<()>` [src]

### `fn new_line(&mut self) -> Result<()>` [src]

### `fn indent(&mut self)` [src]

### `fn dedent(&mut self)` [src]

### `fn write_string_complex(&mut self, string: &str, start: usize) -> Result<()>` [src]

### `fn write_string(&mut self, string: &str) -> Result<()>` [src]

### `fn write_number(&mut self, num: &Number) -> Result<()>` [src]

### `fn write_object(&mut self, object: &Object) -> Result<()>` [src]

### `fn write_json(&mut self, json: &JsonValue) -> Result<()>` [src]

Loading content...

## Implementors

### `impl Generator for DumpGenerator` [src]

#### `type T = Vec<u8>`

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

#### `fn write_char(&mut self, ch: u8) -> Result<()>` [src]

#### `fn get_writer(&mut self) -> &mut Vec<u8>` [src]

#### `fn write_min(&mut self, _: &[u8], min: u8) -> Result<()>` [src]

### `impl Generator for PrettyGenerator` [src]

#### `type T = Vec<u8>`

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

#### `fn write_char(&mut self, ch: u8) -> Result<()>` [src]

#### `fn get_writer(&mut self) -> &mut Vec<u8>` [src]

#### `fn write_min(&mut self, slice: &[u8], _: u8) -> Result<()>` [src]

#### `fn new_line(&mut self) -> Result<()>` [src]

#### `fn indent(&mut self)` [src]

#### `fn dedent(&mut self)` [src]

### `impl<'a, W> Generator for PrettyWriterGenerator<'a, W> where
W: Write,` [src]

#### `type T = W`

#### `fn get_writer(&mut self) -> &mut W` [src]

#### `fn write_min(&mut self, slice: &[u8], _: u8) -> Result<()>` [src]

#### `fn new_line(&mut self) -> Result<()>` [src]

#### `fn indent(&mut self)` [src]

#### `fn dedent(&mut self)` [src]

### `impl<'a, W> Generator for WriterGenerator<'a, W> where
W: Write,` [src]

#### `type T = W`

#### `fn get_writer(&mut self) -> &mut W` [src]

#### `fn write_min(&mut self, _: &[u8], min: u8) -> Result<()>` [src]

Loading content...