Module git_config::parser[][src]

Expand description

This module handles parsing a git-config file. Generally speaking, you want to use a higher abstraction such as GitConfig unless you have some explicit reason to work with events instead.

The general workflow for interacting with this is to use one of the parse_from_* function variants. These will return a Parser on success, which can be converted into an Event iterator. The Parser also has additional methods for accessing leading comments or events by section.

Structs

A parser error reports the one-indexed line number where the parsing error occurred, as well as the last parser node and the remaining data to be parsed.

Wrapper struct for key names, since keys are case-insensitive.

A parsed comment event containing the comment marker and comment.

A parsed section containing the header and the section events.

A parsed section header, containing a name and optionally a subsection name.

A zero-copy git-config file parser.

Wrapper struct for section header names, since section headers are case-insensitive.

Enums

Syntactic events that occurs in the config. Despite all these variants holding a Cow instead over a simple reference, the parser will only emit borrowed Cow variants.

An error type representing a Parser Error or an IO error. This is returned from functions that will perform IO on top of standard parsing, such as reading from a file.

Functions

Attempt to zero-copy parse the provided bytes. On success, returns a Parser that provides methods to accessing leading comments and sections of a git-config file and can be converted into an iterator of Event for higher level processing.

Parses the provided bytes, returning an Parser that contains allocated and owned events. This is similar to parse_from_bytes, but performance is degraded as it requires allocation for every event. However, this permits the reference bytes to be dropped, allowing the parser to be passed around without lifetime worries.

Parses a git config located at the provided path. On success, returns a Parser that provides methods to accessing leading comments and sections of a git-config file and can be converted into an iterator of Event for higher level processing.

Attempt to zero-copy parse the provided &str. On success, returns a Parser that provides methods to accessing leading comments and sections of a git-config file and can be converted into an iterator of Event for higher level processing.