Trait SerializeAttribute

Source
pub trait SerializeAttribute: Sized {
    // Required method
    fn serialize_attribute<S: AttributeSerializer>(
        &self,
        serializer: S,
    ) -> Result<S::Ok, S::Error>;
}
Expand description

A type that can be serialized as an attribute. Since this is a separate trait from Serialize, it is possible to choose between serializing a type as an attribute or as an element.

To see the documentation for the derive macro, see [xmlity_derive::SerializeAttribute].

Required Methods§

Source

fn serialize_attribute<S: AttributeSerializer>( &self, serializer: S, ) -> Result<S::Ok, S::Error>

Serialize the attribute.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: SerializeAttribute> SerializeAttribute for Option<T>

Source§

fn serialize_attribute<S: AttributeSerializer>( &self, serializer: S, ) -> Result<S::Ok, S::Error>

Source§

impl<T: SerializeAttribute> SerializeAttribute for Box<T>

Source§

fn serialize_attribute<S: AttributeSerializer>( &self, serializer: S, ) -> Result<S::Ok, S::Error>

Implementors§