NetdocParseableFields

Trait NetdocParseableFields 

Source
pub trait NetdocParseableFields: Sized {
    type Accumulator: Sized + Debug + Send + Sync + 'static;

    // Required methods
    fn is_item_keyword(kw: KeywordRef<'_>) -> bool;
    fn accumulate_item(
        acc: &mut Self::Accumulator,
        item: UnparsedItem<'_>,
    ) -> Result<(), EP>;
    fn finish(acc: Self::Accumulator) -> Result<Self, EP>;
}
Available on crate feature parse2 only.
Expand description

A collection of fields that can be parsed within a section

None of the items can be structural.

Normally derived.

Required Associated Types§

Source

type Accumulator: Sized + Debug + Send + Sync + 'static

The partially-parsed set of items.

Required Methods§

Source

fn is_item_keyword(kw: KeywordRef<'_>) -> bool

Is this one of the keywords in this struct

Source

fn accumulate_item( acc: &mut Self::Accumulator, item: UnparsedItem<'_>, ) -> Result<(), EP>

Accumulate an item in this struct

§Panics

The caller must have first checked the item’s keyword with is_item_keyword. If this isn’t an item for this structure, may panic.

Source

fn finish(acc: Self::Accumulator) -> Result<Self, EP>

Finish

Resolves the Accumulator into the output type. Generally, this means throwing an error if expected fields were not present.

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 NetdocParseableFields for Ignored

Source§

type Accumulator = IgnoredNetdocParseAccumulator