validate_index!() { /* proc-macro */ }Expand description
Validates an index file and all templates it references at compile time.
This macro parses the index file, extracts all template file names from the Template column, and validates each template during compilation. If the index file is invalid or any referenced template is invalid, a compile error is emitted.
§Arguments
path- A string literal path to the index file, relative to the calling crate’sCargo.tomldirectory. The templates are expected to be in the same directory as the index file.
§Example
ⓘ
use textfsm_macros::validate_index;
// Validate index and all referenced templates
validate_index!("templates/index");§Compile-time Errors
If the index or any template is invalid, you’ll see a compile error like:
error: Index validation failed for 'templates/index':
Template 'cisco_show_version.textfsm' (line 3): invalid rule at line 5