Skip to main content

validate_templates

Macro validate_templates 

Source
validate_templates!() { /* proc-macro */ }
Expand description

Validates all TextFSM template files in a directory at compile time.

This macro finds all .textfsm files in the specified directory (recursively) and validates each one during compilation. If any template is invalid, a compile error is emitted. If all are valid, the macro expands to nothing.

§Arguments

  • path - A string literal path to the templates directory, relative to the calling crate’s Cargo.toml directory.

§Example

validate_templates!("templates/");

§Compile-time Errors

If any template is invalid, you’ll see a compile error like:

error: Template validation failed for 'templates/bad.textfsm':
       missing required 'Start' state