Trait WithSerializer

Source
pub trait WithSerializer {
    type Serializer<'x>: Serializer<'x>
       where Self: 'x;

    // Required method
    fn serializer<'ser>(
        &'ser self,
        name: Option<&'ser str>,
        is_root: bool,
    ) -> Result<Self::Serializer<'ser>, Error>;
}
Expand description

Trait that defines the Serializer for a type.

Required Associated Types§

Source

type Serializer<'x>: Serializer<'x> where Self: 'x

The serializer to use for this type.

Required Methods§

Source

fn serializer<'ser>( &'ser self, name: Option<&'ser str>, is_root: bool, ) -> Result<Self::Serializer<'ser>, Error>

Initializes a new serializer from the passed value.

§Errors

Returns a suitable Error is the serializer could not be initialized.

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.

Implementors§

Source§

impl<'el> WithSerializer for Element<'el>

Source§

type Serializer<'x> = ElementSerializer<'x, 'el> where 'el: 'x

Source§

impl<X> WithSerializer for X
where X: SerializeBytes + Debug,

Source§

type Serializer<'x> = ContentSerializer<'x, X> where Self: 'x