Skip to main content

validate_template

Macro validate_template 

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

Validates a single TextFSM template file at compile time.

This macro reads and parses the specified template file during compilation. If the template is invalid, a compile error is emitted with details about the parsing error. If valid, the macro expands to nothing (zero runtime cost).

§Arguments

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

§Example

validate_template!("templates/cisco_show_version.textfsm");

§Compile-time Errors

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

error: Template validation failed for 'templates/bad.textfsm':
       invalid rule at line 5: unknown variable 'Interfce'