Skip to main content

Serializer

Trait Serializer 

Source
pub trait Serializer {
    // Required methods
    fn can_serialize(&self, node: &Node) -> bool;
    fn serialize(
        &self,
        node: &Node,
        options: &FormatOptions,
        context: &FormatContext,
    ) -> Result<String, String>;

    // Provided method
    fn priority(&self) -> i32 { ... }
}
Expand description

Custom serializer support Trait for custom node serializers

Required Methods§

Source

fn can_serialize(&self, node: &Node) -> bool

Check if this serializer can handle the given node

Source

fn serialize( &self, node: &Node, options: &FormatOptions, context: &FormatContext, ) -> Result<String, String>

Serialize the node to a string

Provided Methods§

Source

fn priority(&self) -> i32

Get serializer priority (higher = checked first)

Implementors§