frontmatter_gen::parser

Function parse_with_options

Source
pub fn parse_with_options(
    raw_front_matter: &str,
    format: Format,
    options: Option<ParseOptions>,
) -> Result<Frontmatter, Error>
Expand description

Parses raw front matter string into a Frontmatter object based on the specified format.

This function attempts to parse the provided string into a structured Frontmatter object according to the specified format. It performs validation by default and optimises memory allocation where possible.

§Arguments

  • raw_front_matter - A string slice containing the raw front matter content.
  • format - The Format enum specifying the desired format.
  • options - Optional parsing options for controlling validation and limits.

§Returns

A Result containing either the parsed Frontmatter object or a Error.

§Errors

Returns Error if:

  • The input is not valid in the specified format
  • The structure exceeds configured limits
  • The format is unsupported