frontmatter_gen

Module parser

Source
Expand description

§Front Matter Parser and Serialiser Module

This module provides robust functionality for parsing and serialising front matter in various formats (YAML, TOML, and JSON). It focuses on:

  • Memory efficiency through pre-allocation and string optimisation
  • Type safety with comprehensive error handling
  • Performance optimisation with minimal allocations
  • Validation of input data
  • Consistent cross-format handling

§Features

  • Multi-format support (YAML, TOML, JSON)
  • Zero-copy parsing where possible
  • Efficient memory management
  • Comprehensive validation
  • Rich error context

§Usage Example

use frontmatter_gen::{Format, parser};

let yaml = "title: My Post\ndate: 2025-09-09\n";
let front_matter = parser::parse_with_options(
    yaml,
    Format::Yaml,
    None
)?;

Structs§

Functions§

  • Convenience wrapper around parse_with_options using default options.
  • Parses raw front matter string into a Frontmatter object based on the specified format.
  • Converts a Frontmatter object to a string representation in the specified format.
  • Validates a front matter structure against configured limits.