pub struct NodeContent<'i, 'p> { /* private fields */ }Expand description
Type for retrieving the content (arguments, properties, and children) of a single node. It’s important to ensure you drain or otherwise consume all events from this processor, or else the parent parser will be left in an inconsistent state.
Implementations§
Source§impl<'i, 'p> NodeContent<'i, 'p>
impl<'i, 'p> NodeContent<'i, 'p>
Sourcepub fn next_event<ArgumentAnnotation, Argument, PropertyKey, PropertyValueAnnotation, PropertyValue, Error>(
self,
) -> Result<NodeEvent<'i, 'p, ArgumentAnnotation, Argument, PropertyKey, PropertyValueAnnotation, PropertyValue>, NomErr<Error>>where
Argument: ValueBuilder<'i>,
ArgumentAnnotation: AnnotationBuilder<'i>,
PropertyKey: StringBuilder<'i>,
PropertyValue: ValueBuilder<'i>,
PropertyValueAnnotation: AnnotationBuilder<'i>,
Error: ParseError<&'i str> + TagError<&'i str, &'static str> + FromExternalError<&'i str, CharTryFromError> + FromExternalError<&'i str, BoundsError> + ContextError<&'i str, &'static str>,
pub fn next_event<ArgumentAnnotation, Argument, PropertyKey, PropertyValueAnnotation, PropertyValue, Error>(
self,
) -> Result<NodeEvent<'i, 'p, ArgumentAnnotation, Argument, PropertyKey, PropertyValueAnnotation, PropertyValue>, NomErr<Error>>where
Argument: ValueBuilder<'i>,
ArgumentAnnotation: AnnotationBuilder<'i>,
PropertyKey: StringBuilder<'i>,
PropertyValue: ValueBuilder<'i>,
PropertyValueAnnotation: AnnotationBuilder<'i>,
Error: ParseError<&'i str> + TagError<&'i str, &'static str> + FromExternalError<&'i str, CharTryFromError> + FromExternalError<&'i str, BoundsError> + ContextError<&'i str, &'static str>,
Get the next piece of content from a node. This can be an argument,
a property, a set of children, or End if the node
is done.
For correctness, this method is move oriented. If the event is an
argument or property, the event includes a new NodeContent for
fetching the rest of the node. Conversely, if the event is children or
the end of the node, the processor is consumed, because there’s nothing
more that can be retrieved from this node.
Sourcepub fn drain<E>(self) -> Result<DrainOutcome, NomErr<E>>where
E: ParseError<&'i str> + TagError<&'i str, &'static str> + FromExternalError<&'i str, CharTryFromError> + FromExternalError<&'i str, BoundsError> + ContextError<&'i str, &'static str>,
pub fn drain<E>(self) -> Result<DrainOutcome, NomErr<E>>where
E: ParseError<&'i str> + TagError<&'i str, &'static str> + FromExternalError<&'i str, CharTryFromError> + FromExternalError<&'i str, BoundsError> + ContextError<&'i str, &'static str>,
Parse and discard everything in this node. Checks for parse errors, but
otherwise discards all data. Returns DrainOutcome::Empty unless
there are any remaining properties, arguments, or non-empty children
in this node.