Struct UnionWriter

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

Implementations§

Source§

impl UnionWriter<StreamWriter<Sink>>

Source

pub fn sink() -> Self

Source§

impl<W: WriteRaw> 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 + WriteRaw> Debug for UnionWriter<W>

Source§

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

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

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

Source§

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

Source§

type Parent = StrictWriter<W>

Source§

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

Source§

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

Source§

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: VariantName) -> Self

Source§

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

Source§

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

Source§

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

Source§

type Parent = StrictWriter<W>

Source§

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

Source§

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: VariantName, value: &impl StrictEncode, ) -> Result<Self>

Source§

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

Auto Trait Implementations§

§

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

§

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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.