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§
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 Methods§
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.