Expand description

A system for parsing entire nodes and node lists. Unlike the rest of kaydle-primitives, this module doesn’t expose ordinary nom parsers and container types. Instead, because it’s designed specifically to support the implementation of a serde deserializer, it exposes a set of “processors”, which can be used to fetch nodes or the contents of nodes step-by-step.

This module makes extensive use of the builder traits defined in kaydle-primitives (such as ValueBuilder and StringBuilder) to allow callers to precisely control how much information they need from the node. Often you can use () instead of a real KDL type if you don’t care about a value; this will be faster to parse.

This module tries to be as misuse resistant as possible, using borrowing and move semantics to ensure that methods aren’t called out of order. Where build-time correctness is impossible, it instead uses runtime tracking and panics to ensure consistent state.

Structs

Processor for child nodes of a particular node (contained in { }). Returns the child nodes.

Container for a top level kdl document. Returns the nodes in the document.

A single node. Contains the name of the node as well as a NodeContent, which is used to extract the arguments, properties, and children from the node.

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.

Enums

The outcome of a drain operation, indicating if the thing being drained was already empty.

A piece of content from a node.

Traits

Trait for types that contain a node list. Abstracts over a Document, which operates at the top level, and Children which are nested in { }.

Type Definitions

A recognized node. Used in the case where the caller cares that a node was successfully parsed, but not what the actual value of the node is.

A NodeEvent containing no data. Used when the caller care what kind of thing was in the node, but not the actual value / content.