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,
items: &ItemStream<'_>,
) -> Result<Self, EP>;
}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§
Required Methods§
Sourcefn is_item_keyword(kw: KeywordRef<'_>) -> bool
fn is_item_keyword(kw: KeywordRef<'_>) -> bool
Is this one of the keywords in this struct
Sourcefn accumulate_item(
acc: &mut Self::Accumulator,
item: UnparsedItem<'_>,
) -> Result<(), EP>
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.
Sourcefn finish(acc: Self::Accumulator, items: &ItemStream<'_>) -> Result<Self, EP>
fn finish(acc: Self::Accumulator, items: &ItemStream<'_>) -> Result<Self, EP>
Finish
Resolves the Accumulator into the output type.
Generally, this means throwing an error if expected fields were not present.
items is provided to obtain the parsing options and similar purposes.
Its position in the input stream should not be relied on.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T: NetdocParseableFields> NetdocParseableFields for Arc<T>
impl<T: NetdocParseableFields> NetdocParseableFields for Arc<T>
type Accumulator = <T as NetdocParseableFields>::Accumulator
fn is_item_keyword(kw: KeywordRef<'_>) -> bool
fn accumulate_item( acc: &mut Self::Accumulator, item: UnparsedItem<'_>, ) -> Result<(), EP>
fn finish(acc: Self::Accumulator, items: &ItemStream<'_>) -> Result<Self, EP>
Implementors§
Source§impl NetdocParseableFields for AddrPolicy
impl NetdocParseableFields for AddrPolicy
type Accumulator = AddrPolicy
Source§impl NetdocParseableFields for Ignored
impl NetdocParseableFields for Ignored
type Accumulator = IgnoredNetdocParseAccumulator
Source§impl NetdocParseableFields for Lifetime
impl NetdocParseableFields for Lifetime
Source§impl NetdocParseableFields for NotPresent
impl NetdocParseableFields for NotPresent
type Accumulator = NotPresentNetdocParseAccumulator
Source§impl NetdocParseableFields for NotPresentEachValue
impl NetdocParseableFields for NotPresentEachValue
type Accumulator = NotPresentEachValueNetdocParseAccumulator
Source§impl NetdocParseableFields for tor_netdoc::doc::netstatus::md::Preamble
impl NetdocParseableFields for tor_netdoc::doc::netstatus::md::Preamble
Source§impl NetdocParseableFields for tor_netdoc::doc::netstatus::plain::Preamble
impl NetdocParseableFields for tor_netdoc::doc::netstatus::plain::Preamble
Source§impl NetdocParseableFields for tor_netdoc::doc::netstatus::vote::Preamble
Available on crate feature incomplete only.
impl NetdocParseableFields for tor_netdoc::doc::netstatus::vote::Preamble
Available on crate feature
incomplete only.