Trait WriteUnion

Source
pub trait WriteUnion: Sized {
    type Parent: TypedWrite;
    type TupleWriter: WriteTuple<Parent = Self>;
    type StructWriter: WriteStruct<Parent = Self>;

    // Required methods
    fn write_unit(self, name: VariantName) -> Result<Self>;
    fn write_tuple(
        self,
        name: VariantName,
        inner: impl FnOnce(Self::TupleWriter) -> Result<Self>,
    ) -> Result<Self>;
    fn write_struct(
        self,
        name: VariantName,
        inner: impl FnOnce(Self::StructWriter) -> Result<Self>,
    ) -> Result<Self>;
    fn complete(self) -> Self::Parent;

    // Provided method
    fn write_newtype(
        self,
        name: VariantName,
        value: &impl StrictEncode,
    ) -> Result<Self> { ... }
}

Required Associated Types§

Required Methods§

Source

fn write_unit(self, name: VariantName) -> Result<Self>

Source

fn write_tuple( self, name: VariantName, inner: impl FnOnce(Self::TupleWriter) -> Result<Self>, ) -> Result<Self>

Source

fn write_struct( self, name: VariantName, inner: impl FnOnce(Self::StructWriter) -> Result<Self>, ) -> Result<Self>

Source

fn complete(self) -> Self::Parent

Provided Methods§

Source

fn write_newtype( self, name: VariantName, value: &impl StrictEncode, ) -> Result<Self>

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§