pub struct UnionWriter<W: Write> { /* private fields */ }

Implementations§

source§

impl UnionWriter<Sink>

source

pub fn sink() -> Self

source§

impl<W: Write> UnionWriter<W>

source

pub fn with<T: StrictSum>(parent: StrictWriter<W>) -> Self

source

pub fn is_written(&self) -> bool

source

pub fn variants(&self) -> &BTreeMap<Variant, VariantType>

source

pub fn name(&self) -> &str

source

pub fn tag_by_name(&self, name: &VariantName) -> u8

Trait Implementations§

source§

impl<W: Debug + Write> Debug for UnionWriter<W>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<W: Write> DefineEnum for UnionWriter<W>

source§

impl<W: Write> DefineUnion for UnionWriter<W>

§

type Parent = StrictWriter<W>

§

type TupleDefiner = StructWriter<W, UnionWriter<W>>

§

type StructDefiner = StructWriter<W, UnionWriter<W>>

§

type UnionWriter = UnionWriter<W>

source§

fn define_unit(self, name: VariantName) -> Self

source§

fn define_tuple( self, name: VariantName, inner: impl FnOnce(Self::TupleDefiner) -> Self ) -> Self

source§

fn define_struct( self, name: VariantName, inner: impl FnOnce(Self::StructDefiner) -> Self ) -> Self

source§

fn complete(self) -> Self::UnionWriter

source§

fn define_newtype<T: StrictEncode + StrictDumb>(self, name: FieldName) -> Self

source§

impl<W: Write> StrictParent<W> for UnionWriter<W>

§

type Remnant = UnionWriter<Sink>

source§

fn from_write_split(writer: StrictWriter<W>, remnant: Self::Remnant) -> Self

source§

fn into_write_split(self) -> (StrictWriter<W>, Self::Remnant)

source§

impl<W: Write> WriteEnum for UnionWriter<W>

§

type Parent = StrictWriter<W>

source§

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

source§

fn complete(self) -> Self::Parent

source§

impl<W: Write> WriteUnion for UnionWriter<W>

§

type Parent = StrictWriter<W>

§

type TupleWriter = StructWriter<W, UnionWriter<W>>

§

type StructWriter = StructWriter<W, UnionWriter<W>>

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

source§

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

source§

impl<W: Write> TypedParent for UnionWriter<W>

Auto Trait Implementations§

§

impl<W> RefUnwindSafe for UnionWriter<W>where W: RefUnwindSafe,

§

impl<W> Send for UnionWriter<W>where W: Send,

§

impl<W> Sync for UnionWriter<W>where W: Sync,

§

impl<W> Unpin for UnionWriter<W>where W: Unpin,

§

impl<W> UnwindSafe for UnionWriter<W>where W: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.