Trait SerializeElement

Source
pub trait SerializeElement {
    type Ok;
    type Error: Error;
    type ChildrenSerializeSeq: SerializeSeq<Ok = Self::Ok, Error = Self::Error>;
    type SerializeElementAttributes: SerializeElementAttributes<Ok = Self::Ok, Error = Self::Error>;

    // Required methods
    fn include_prefix(
        &mut self,
        should_enforce: IncludePrefix,
    ) -> Result<Self::Ok, Self::Error>;
    fn preferred_prefix(
        &mut self,
        preferred_prefix: Option<Prefix<'_>>,
    ) -> Result<Self::Ok, Self::Error>;
    fn serialize_attributes(
        self,
    ) -> Result<Self::SerializeElementAttributes, Self::Error>;
    fn serialize_children(
        self,
    ) -> Result<Self::ChildrenSerializeSeq, Self::Error>;
    fn end(self) -> Result<Self::Ok, Self::Error>;
}
Expand description

A trait for serializing elements.

Required Associated Types§

Source

type Ok

The type of the value that is returned when serialization is successful.

Source

type Error: Error

The type of the error that is returned when serialization fails.

Source

type ChildrenSerializeSeq: SerializeSeq<Ok = Self::Ok, Error = Self::Error>

The type of the serializer that is returned when serializing the children of this element.

Source

type SerializeElementAttributes: SerializeElementAttributes<Ok = Self::Ok, Error = Self::Error>

The type of the serializer that is returned when serializing the attributes of this element.

Required Methods§

Source

fn include_prefix( &mut self, should_enforce: IncludePrefix, ) -> Result<Self::Ok, Self::Error>

Always serialize this element with the given prefix.

Source

fn preferred_prefix( &mut self, preferred_prefix: Option<Prefix<'_>>, ) -> Result<Self::Ok, Self::Error>

Set the preferred prefix for this element.

Source

fn serialize_attributes( self, ) -> Result<Self::SerializeElementAttributes, Self::Error>

Serialize the attributes of this element.

Source

fn serialize_children(self) -> Result<Self::ChildrenSerializeSeq, Self::Error>

Serialize the children of this element.

Source

fn end(self) -> Result<Self::Ok, Self::Error>

End the serialization of this element with no children.

Implementors§