Trait slog::Serializer[][src]

pub trait Serializer {
    fn emit_arguments(&mut self, key: Key, val: &Arguments) -> Result;

    fn emit_usize(&mut self, key: Key, val: usize) -> Result { ... }
fn emit_isize(&mut self, key: Key, val: isize) -> Result { ... }
fn emit_bool(&mut self, key: Key, val: bool) -> Result { ... }
fn emit_char(&mut self, key: Key, val: char) -> Result { ... }
fn emit_u8(&mut self, key: Key, val: u8) -> Result { ... }
fn emit_i8(&mut self, key: Key, val: i8) -> Result { ... }
fn emit_u16(&mut self, key: Key, val: u16) -> Result { ... }
fn emit_i16(&mut self, key: Key, val: i16) -> Result { ... }
fn emit_u32(&mut self, key: Key, val: u32) -> Result { ... }
fn emit_i32(&mut self, key: Key, val: i32) -> Result { ... }
fn emit_f32(&mut self, key: Key, val: f32) -> Result { ... }
fn emit_u64(&mut self, key: Key, val: u64) -> Result { ... }
fn emit_i64(&mut self, key: Key, val: i64) -> Result { ... }
fn emit_f64(&mut self, key: Key, val: f64) -> Result { ... }
fn emit_u128(&mut self, key: Key, val: u128) -> Result { ... }
fn emit_i128(&mut self, key: Key, val: i128) -> Result { ... }
fn emit_str(&mut self, key: Key, val: &str) -> Result { ... }
fn emit_unit(&mut self, key: Key) -> Result { ... }
fn emit_none(&mut self, key: Key) -> Result { ... }
fn emit_serde(&mut self, key: Key, value: &SerdeValue) -> Result { ... } }

Serializer

Drains using Format will internally use types implementing this trait.

Required Methods

Emit fmt::Arguments

This is the only method that has to implemented, but for performance and to retain type information most serious Serializers will want to implement all other methods as well.

Provided Methods

Emit usize

Emit isize

Emit bool

Emit char

Emit u8

Emit i8

Emit u16

Emit i16

Emit u32

Emit i32

Emit f32

Emit u64

Emit i64

Emit f64

Emit u128

Emit i128

Emit &str

Emit ()

Emit None

Emit a value implementing serde::Serialize

This is especially useful for composite values, eg. structs as Json values, or sequences.

To prevent pulling-in serde dependency, this is an extension behind a serde feature flag.

The value needs to implement SerdeValue.

Implementors