Trait SerializeFlags

Source
pub trait SerializeFlags {
    type Ok;
    type Error: Error;

    // Required methods
    fn serialize_field<T>(
        &mut self,
        key: &str,
        value: &T,
    ) -> Result<(), Self::Error>
       where T: ?Sized + Serialize;
    fn end(self) -> Result<Self::Ok, Self::Error>;

    // Provided methods
    fn serialize_empty_bit(&mut self) -> Result<(), Self::Error> { ... }
    fn serialize_bits<T>(&mut self, value: &T) -> Result<(), Self::Error>
       where T: ?Sized + Serialize { ... }
}
Expand description

Returned from Serializer::serialize_enum_flags.

Required Associated Types§

Source

type Ok

Must match the Ok type of our Serializer.

Source

type Error: Error

Must match the Error type of our Serializer.

Required Methods§

Source

fn serialize_field<T>( &mut self, key: &str, value: &T, ) -> Result<(), Self::Error>
where T: ?Sized + Serialize,

Serialize a enum or bit field.(Only used by XML serializer.)

Source

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

Finish serializing flags.

Provided Methods§

Source

fn serialize_empty_bit(&mut self) -> Result<(), Self::Error>

Serialization process when the flag is 0bits.(Only used by XML serializer.)

The default implementation does nothing.

Source

fn serialize_bits<T>(&mut self, value: &T) -> Result<(), Self::Error>
where T: ?Sized + Serialize,

Serialize all bits of a flag.(Only used by binary serializer.)

The default implementation does nothing.

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§