template_file

Macro template_file 

Source
macro_rules! template_file {
    ($path:expr) => { ... };
    ($path:expr, labels: [$($label:expr),* $(,)?]) => { ... };
}
Expand description

Macro to create a TemplateFile from a file path at compile time.

This macro uses include_str! to embed the template content directly into the binary at compile time. It supports an optional labels parameter to add GitHub issue labels.

§Syntax

  • template_file!("path/to/template.txt") - Basic usage
  • template_file!("path/to/template.txt", labels: ["bug", "urgent"]) - With labels

§Examples

use bug::template_file;
 
// Basic usage (assumes you have a template.txt file)
let template = template_file!("templates/bug_report.txt");
 
// With labels
let labeled_template = template_file!(
    "templates/crash_report.txt", 
    labels: ["bug", "crash", "high-priority"]
);

§Template File Format

Template files should have the title on the first line and the body on subsequent lines:

Bug Report: {component}
## Description
{description}
 
## Steps to Reproduce
{steps}