macro_rules! include_template {
($path:expr) => { ... };
}Expand description
Macro to verify that a string comes from a template file.
This macro provides compile-time assurance by using include_str! which
only works with files at compile time. This prevents inline prompt strings
from being accidentally used.
§Example
ⓘ
use crate::prompts::template_macros::include_template;
// This works - loads from template file
let template = include_template!("templates/my_prompt.txt");
// This would NOT work with include_template! macro - prevents inline templates
// let inline = "Hello {{NAME}}"; // Cannot be passed to include_template!§Enforcement
- The macro uses
concat!withinclude_str!to ensure the template path is known at compile time - Returns a
&'static strwhich makes it clear this is compiled content