Skip to main content

Module ser

Module ser 

Source
Expand description

Serde serializer for structprop documents. Serde Serializer for the structprop format.

The public entry point is to_string. Internally a Serializer walks the serde data model and writes structprop text directly into an output String.

§Type mapping

Rust / serdeStructprop output
booltrue or false scalar
i8i64, u8u64bare integer scalar (e.g. 42, -7)
f32, f64bare float scalar (e.g. 3.14)
charbare single-character scalar (quoted if the character is special)
String / &strbare scalar, or "quoted" if it contains spaces, tabs, newlines, carriage returns, #, {, }, or =, or is empty; yields Error::UnsupportedType if the value requires quoting and contains ", or if the value starts with "
None / () / unit structnull scalar
newtype structtransparent — serializes as the inner value
struct / mapkey { … } block at the current indentation level
Vec<T> / sequence / tuple / tuple struct= { … } inline list
unit enum variantbare variant name scalar
newtype enum variantvariant_name = <scalar or list>
tuple enum variantvariant_name = { … } list
struct enum variantvariant_name { … } block

Structs§

MapSerializer
ser::SerializeMap (and struct impls) that writes key = value / key { … } entries one at a time.
SeqSerializer
ser::SerializeSeq (and related tuple impls) that collects rendered items then emits them as a { … } block.
Serializer
Core serializer that accumulates structprop text in output.

Functions§

to_string
Serialize value into a structprop-formatted String.