frontmatter_gen::parser

Function validate_frontmatter

Source
pub fn validate_frontmatter(
    fm: &Frontmatter,
    max_depth: usize,
    max_keys: usize,
) -> Result<(), Error>
Expand description

Validates a front matter structure against configured limits.

Checks:

  • Maximum nesting depth.
  • Maximum number of keys.
  • Structure validity.

§Arguments

  • fm - Reference to the front matter to validate.
  • max_depth - Maximum allowed nesting depth.
  • max_keys - Maximum allowed number of keys.

§Returns

Ok(()) if validation passes, Error otherwise.

§Errors

Returns Error if:

  • The number of keys exceeds max_keys.
  • The nesting depth exceeds max_depth.