WriteScalar

Trait WriteScalar 

Source
pub trait WriteScalar: DomSerializer {
    // Provided methods
    fn format_scalar(&self, value: Peek<'_, '_>) -> Option<String> { ... }
    fn write_scalar(&mut self, value: Peek<'_, '_>) -> Result<bool, Self::Error> { ... }
    fn write_float(&self, value: f64, buf: &mut ScalarBuffer) { ... }
}
Expand description

Extension trait for writing scalar values directly to output.

Provided Methods§

Source

fn format_scalar(&self, value: Peek<'_, '_>) -> Option<String>

Format a scalar value to a string (for attributes).

Returns Some(string) if the value is a scalar, None otherwise.

Source

fn write_scalar(&mut self, value: Peek<'_, '_>) -> Result<bool, Self::Error>

Write a scalar value to the serializer’s output.

Returns Ok(true) if the value was written, Ok(false) if not a scalar. Override to customize formatting (e.g., custom float precision).

Source

fn write_float(&self, value: f64, buf: &mut ScalarBuffer)

Write a float value. Override to customize float formatting.

Implementors§