Skip to main content

StreamEnum

Trait StreamEnum 

Source
pub trait StreamEnum<'sval> {
    type Ok;
    type Tuple: StreamTuple<'sval, Ok = Self::Ok>;
    type Record: StreamRecord<'sval, Ok = Self::Ok>;
    type Nested: StreamEnum<'sval, Ok = Self::Ok, Nested = Self::Nested>;

    // Required methods
    fn tag(
        self,
        tag: Option<Tag>,
        label: Option<Label<'_>>,
        index: Option<Index>,
    ) -> Result<Self::Ok>;
    fn tagged_computed<V: Value>(
        self,
        tag: Option<Tag>,
        label: Option<Label<'_>>,
        index: Option<Index>,
        value: V,
    ) -> Result<Self::Ok>;
    fn tuple_begin(
        self,
        tag: Option<Tag>,
        label: Option<Label<'_>>,
        index: Option<Index>,
        num_entries: Option<usize>,
    ) -> Result<Self::Tuple>;
    fn record_begin(
        self,
        tag: Option<Tag>,
        label: Option<Label<'_>>,
        index: Option<Index>,
        num_entries: Option<usize>,
    ) -> Result<Self::Record>;
    fn nested<F: FnOnce(Self::Nested) -> Result<<Self::Nested as StreamEnum<'sval>>::Ok>>(
        self,
        tag: Option<Tag>,
        label: Option<Label<'_>>,
        index: Option<Index>,
        variant: F,
    ) -> Result<Self::Ok>;
    fn empty(self) -> Result<Self::Ok>;

    // Provided methods
    fn tagged<V: ValueRef<'sval>>(
        self,
        tag: Option<Tag>,
        label: Option<Label<'_>>,
        index: Option<Index>,
        value: V,
    ) -> Result<Self::Ok>
       where Self: Sized { ... }
    fn tagged_ref<V: Value + ?Sized>(
        self,
        tag: Option<Tag>,
        label: Option<Label<'_>>,
        index: Option<Index>,
        value: &'sval V,
    ) -> Result<Self::Ok>
       where Self: Sized { ... }
}
Expand description

A stream for an enum.

Required Associated Types§

Source

type Ok

The type of result produced by this stream on completion.

Source

type Tuple: StreamTuple<'sval, Ok = Self::Ok>

Stream a tuple variant.

Source

type Record: StreamRecord<'sval, Ok = Self::Ok>

Stream a record variant.

Source

type Nested: StreamEnum<'sval, Ok = Self::Ok, Nested = Self::Nested>

Stream a nested enum variant.

Required Methods§

Source

fn tag( self, tag: Option<Tag>, label: Option<Label<'_>>, index: Option<Index>, ) -> Result<Self::Ok>

Stream a tag variant.

Source

fn tagged_computed<V: Value>( self, tag: Option<Tag>, label: Option<Label<'_>>, index: Option<Index>, value: V, ) -> Result<Self::Ok>

Stream a tagged value variant, borrowed for an arbitrarily short lifetime.

Source

fn tuple_begin( self, tag: Option<Tag>, label: Option<Label<'_>>, index: Option<Index>, num_entries: Option<usize>, ) -> Result<Self::Tuple>

Stream a tuple variant.

Source

fn record_begin( self, tag: Option<Tag>, label: Option<Label<'_>>, index: Option<Index>, num_entries: Option<usize>, ) -> Result<Self::Record>

Stream a record variant.

Source

fn nested<F: FnOnce(Self::Nested) -> Result<<Self::Nested as StreamEnum<'sval>>::Ok>>( self, tag: Option<Tag>, label: Option<Label<'_>>, index: Option<Index>, variant: F, ) -> Result<Self::Ok>

Recurse into a nested variant.

Source

fn empty(self) -> Result<Self::Ok>

Stream an empty variant.

Provided Methods§

Source

fn tagged<V: ValueRef<'sval>>( self, tag: Option<Tag>, label: Option<Label<'_>>, index: Option<Index>, value: V, ) -> Result<Self::Ok>
where Self: Sized,

Stream a tagged value variant.

Source

fn tagged_ref<V: Value + ?Sized>( self, tag: Option<Tag>, label: Option<Label<'_>>, index: Option<Index>, value: &'sval V, ) -> Result<Self::Ok>
where Self: Sized,

Stream a reference to a tagged value variant.

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§

Source§

impl<'sval, Ok> StreamEnum<'sval> for Unsupported<Ok>