Skip to main content

section_header_present

Function section_header_present 

Source
pub fn section_header_present(src: &str, name: &str) -> bool
Expand description

Returns true when name is an active (non-commented) TOML section header in src.

Correctly handles:

  • Exact bare header: [name] on its own line.
  • Inline comment: [name] # remark โ€” header is active.
  • Implicit subtable parent: [name.foo] implies [name] is active.
  • Commented header: # [name] โ€” returns false.

ยงPanics

Never panics in practice โ€” regex::escape always produces a valid pattern.