pub trait Serializer {
Show 21 methods fn emit_arguments(
        &mut self,
        key: &'static str,
        val: &Arguments<'_>
    ) -> Result<(), Error>; fn emit_usize(&mut self, key: &'static str, val: usize) -> Result<(), Error> { ... } fn emit_isize(&mut self, key: &'static str, val: isize) -> Result<(), Error> { ... } fn emit_bool(&mut self, key: &'static str, val: bool) -> Result<(), Error> { ... } fn emit_char(&mut self, key: &'static str, val: char) -> Result<(), Error> { ... } fn emit_u8(&mut self, key: &'static str, val: u8) -> Result<(), Error> { ... } fn emit_i8(&mut self, key: &'static str, val: i8) -> Result<(), Error> { ... } fn emit_u16(&mut self, key: &'static str, val: u16) -> Result<(), Error> { ... } fn emit_i16(&mut self, key: &'static str, val: i16) -> Result<(), Error> { ... } fn emit_u32(&mut self, key: &'static str, val: u32) -> Result<(), Error> { ... } fn emit_i32(&mut self, key: &'static str, val: i32) -> Result<(), Error> { ... } fn emit_f32(&mut self, key: &'static str, val: f32) -> Result<(), Error> { ... } fn emit_u64(&mut self, key: &'static str, val: u64) -> Result<(), Error> { ... } fn emit_i64(&mut self, key: &'static str, val: i64) -> Result<(), Error> { ... } fn emit_f64(&mut self, key: &'static str, val: f64) -> Result<(), Error> { ... } fn emit_u128(&mut self, key: &'static str, val: u128) -> Result<(), Error> { ... } fn emit_i128(&mut self, key: &'static str, val: i128) -> Result<(), Error> { ... } fn emit_str(&mut self, key: &'static str, val: &str) -> Result<(), Error> { ... } fn emit_unit(&mut self, key: &'static str) -> Result<(), Error> { ... } fn emit_none(&mut self, key: &'static str) -> Result<(), Error> { ... } fn emit_error(
        &mut self,
        key: &'static str,
        error: &(dyn Error + 'static)
    ) -> Result<(), Error> { ... }
}
Expand description

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 type implementing std::error::Error

Error values are a bit special as their Display implementation doesn’t show full information about the type but must be retrieved using source(). This can be used for formatting sources of errors differntly.

The default implementation of this method formats the sources separated with : . Serializers are encouraged to take advantage of the type information and format it as appropriate.

This method is only available in std because the Error trait is not available without std.

Implementors