Module git_config::parser[][src]

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

Error

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.

Key

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

ParsedComment

A parsed comment event containing the comment marker and comment.

ParsedSection

A parsed section containing the header and the section events.

ParsedSectionHeader

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

Parser

A zero-copy git-config file parser.

SectionHeaderName

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

Enums

Event

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.

Functions

parse_from_bytes

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.

parse_from_str

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.