Skip to main content

serialize_to_xml

Function serialize_to_xml 

Source
pub fn serialize_to_xml<T: Serialize + ?Sized>(
    data: &T,
) -> Result<String, DeError>
Expand description

Serializes data to XML, handling all serializable types.

Named structs serialize directly (using the struct name as root element). Map-like types are wrapped in a <data> root tag with keys sanitized to valid XML element names. Primitive types (strings, numbers, booleans) are wrapped as <data><value>...</value></data>. Null values produce an empty <data/> element.