pub trait ItemSetMethods: Copy + Sized {
type Each: Sized;
type Field: Sized;
// Required methods
fn can_accumulate(self, acc: &Option<Self::Field>) -> Result<(), EP>;
fn accumulate(
self,
acc: &mut Option<Self::Field>,
one: Self::Each,
) -> Result<(), EP>;
fn finish(
self,
acc: Option<Self::Field>,
item_keyword: &'static str,
) -> Result<Self::Field, EP>;
// Provided methods
fn is_intro_item_keyword(self, kw: KeywordRef<'_>) -> bool
where Self::Each: NetdocParseable { ... }
fn finish_subdoc(self, acc: Option<Self::Field>) -> Result<Self::Field, EP>
where Self::Each: NetdocParseable { ... }
fn check_item_value_parseable(self)
where Self::Each: ItemValueParseable { ... }
fn check_signature_item_parseable(self)
where Self::Each: SignatureItemParseable { ... }
fn check_subdoc_parseable(self)
where Self::Each: NetdocParseable { ... }
fn check_item_argument_parseable(self)
where Self::Each: ItemArgumentParseable { ... }
}
parse2
only.Expand description
Methods for handling some multiplicity of Items
For use by macros.
During parsing, we accumulate into a value of type Option<Self::Field>
.
The semantics of this are item-set-implementation-dependent;
using a type which is generic over the field type in a simple way
allows the partially-parsed accumulation state for a whole netdoc to have a concrete type.
See ItemSetSelector
and the module-level docs.
Required Associated Types§
Required Methods§
Sourcefn can_accumulate(self, acc: &Option<Self::Field>) -> Result<(), EP>
fn can_accumulate(self, acc: &Option<Self::Field>) -> Result<(), EP>
Can we accumulate another item ?
Can be used to help predict whether accumulate
will throw.
Provided Methods§
Sourcefn is_intro_item_keyword(self, kw: KeywordRef<'_>) -> boolwhere
Self::Each: NetdocParseable,
fn is_intro_item_keyword(self, kw: KeywordRef<'_>) -> boolwhere
Self::Each: NetdocParseable,
If the contained type is a sub-document, call its is_intro_item_keyword
.
Sourcefn finish_subdoc(self, acc: Option<Self::Field>) -> Result<Self::Field, EP>where
Self::Each: NetdocParseable,
fn finish_subdoc(self, acc: Option<Self::Field>) -> Result<Self::Field, EP>where
Self::Each: NetdocParseable,
finish
for if the contained type is a wsub-document
Obtain the sub-document’s intro keyword from its doctype_for_error
.
Sourcefn check_item_value_parseable(self)where
Self::Each: ItemValueParseable,
fn check_item_value_parseable(self)where
Self::Each: ItemValueParseable,
Check that the element type is an Item
For providing better error messages when struct fields don’t implement the right trait.
See derive.rs
, and search for this method name.
Sourcefn check_signature_item_parseable(self)where
Self::Each: SignatureItemParseable,
fn check_signature_item_parseable(self)where
Self::Each: SignatureItemParseable,
Check that the element type is a Signature
Sourcefn check_subdoc_parseable(self)where
Self::Each: NetdocParseable,
fn check_subdoc_parseable(self)where
Self::Each: NetdocParseable,
Check that the element type is a sub-document
Sourcefn check_item_argument_parseable(self)where
Self::Each: ItemArgumentParseable,
fn check_item_argument_parseable(self)where
Self::Each: ItemArgumentParseable,
Check that the element type is an argument
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.