Skip to main content

Module core

Module core 

Source

Structs§

CheckIssue
One validation finding from validate_sections.
CommentStyle
Comment style for a language
GroupSummary
Per-group summary across one or more files.
LineRange
Line range representation
ScanJsonFile
JSON file reference for --scan --json output (PRD §0.14.4).
ScanJsonRoot
Root of the nested scan JSON tree.
ScanJsonVariant
One variant inside a pair/group entry.
ScanSectionInfo
Information about a discovered toggle section for scan output.
SectionInfo
A discovered section marker with metadata (used by discover_sections and find_and_toggle_section).
SectionToggleResult
Result of toggling a section, including parsed metadata.

Enums§

CheckLevel
Severity for a --check finding (PRD §0.14.3).
ScanJsonEntry
One top-level entry in the scan JSON tree (solo or grouped).
SectionType
Inferred type of a section group (PRD §0.14.1).

Functions§

activate_variant
Activate group:variant: uncomment that variant, comment every other variant of the group.
build_scan_json
Build the nested scan JSON tree from flat scan rows (PRD §0.14.4).
discover_sections
Scan file content for all section marker pairs and return their metadata. Unclosed sections are silently skipped (useful for discovery across many files).
discover_variants
Return all SectionInfo whose ID parses into the given group. discover_variants(content, "db") matches both db (solo) and db:postgres (variant).
find_and_toggle_section
Find section markers and toggle the content between them. Returns a SectionToggleResult with modification status and parsed desc.
get_comment_style
Get the comment style for a file based on its extension. If a config is provided, language-specific overrides take priority, then global overrides, then the hardcoded defaults.
merge_ranges
Merge multiple line ranges into a minimal list of non-overlapping ranges. Sorts ascending by start, then coalesces overlapping/adjacent intervals.
parse_id_parts
Split a section ID into (group, variant) parts using the first : as separator. Solo IDs (no colon) return (id, None); variant IDs return (group, Some(variant)).
parse_line_range
Parse a line range specification. Supports formats: “start:end”, “start:+count”, “single_line”
scan_sections
Scan file content for toggle:start / toggle:end markers. Returns all sections found with state info. Does not modify anything.
summarize_scan
Group flat scan results into per-group summaries with inferred type.
supported_extensions
Returns the list of file extensions that toggle knows how to handle.
toggle_comments
Toggle comments in the specified line ranges. marker: comment prefix (e.g. "#", "//", "--"). Defaults to "#" if None. force_mode: Some("on") = always comment, Some("off") = always uncomment, None = invert.
toggle_comments_multi
Toggle comments using multi-line/block comment delimiters. For each merged range, wraps the content in start/end delimiters (commenting) or strips them (uncommenting). Force mode works the same as single-line.
toggle_comments_with_marker
Toggle comments with an explicit comment marker.
toggle_variant_group
Toggle every variant of group in content.
validate_sections
Run validation on already-scanned sections grouped by file (PRD §0.14.3). pair_only = true skips the pair-mismatch check on solos (i.e. when invoked with --check --pair, a 3-variant group is still flagged).