pub trait WriteUnion: Sized {
type Parent: TypedWrite;
type TupleWriter: WriteTuple<Parent = Self>;
type StructWriter: WriteStruct<Parent = Self>;
fn write_unit(self, name: FieldName) -> Result<Self>;
fn write_tuple(
self,
name: FieldName,
inner: impl FnOnce(Self::TupleWriter) -> Result<Self>
) -> Result<Self>;
fn write_struct(
self,
name: FieldName,
inner: impl FnOnce(Self::StructWriter) -> Result<Self>
) -> Result<Self>;
fn complete(self) -> Self::Parent;
fn write_newtype(
self,
name: FieldName,
value: &impl StrictEncode
) -> Result<Self> { ... }
}