Expand description
§Bug Reporting Library
A Rust library for generating GitHub issue URLs with customizable templates.
Supports both std
and no_std
environments, making it suitable for embedded systems,
WebAssembly, and other constrained environments.
§Features
- Template-based bug reporting: Define reusable issue templates with placeholders
- GitHub integration: Generate direct links to GitHub’s new issue page
- no_std support: Works in embedded and constrained environments
- Terminal hyperlinks: Smart hyperlink detection for modern terminals
- Flexible output: Customizable output destinations
§Quick Start
§Global Configuration (std only)
use bug::{init, bug, IssueTemplate};
// Initialize with your GitHub repository
init("username", "repository")
.add_template("crash", IssueTemplate::new(
"Application Crash: {error_type}",
"The application crashed with error: {error_message}\n\nSteps to reproduce:\n{steps}"
))
.build()
.expect("Failed to initialize bug reporting");
// Use the bug! macro to report issues
let url = bug!("crash", {
error_type = "NullPointerException",
error_message = "Attempted to access null pointer",
steps = "1. Start app\n2. Click button\n3. Crash occurs"
});
§Handle-based API (std and no_std)
use bug::{init_handle, bug_with_handle, IssueTemplate};
let handle = init_handle("username", "repository")
.add_template("bug", IssueTemplate::new("Bug Report", "Found a bug: {description}"));
let url = bug_with_handle!(handle, "bug", {
description = "Button doesn't work"
});
Modules§
- url_
encode - URL encoding utilities for no_std compatibility.
Macros§
- bug
- Report a bug using the global configuration (std only).
- bug_
with_ handle - Report a bug using a specific handle (works in both std and no_std).
- template_
file - Macro to create a
TemplateFile
from a file path at compile time.
Structs§
- BugReport
Config - Configuration for the bug reporting system.
- BugReport
Config Builder - Builder for configuring the global bug reporting system (std only).
- BugReport
Handle - A handle for bug reporting that doesn’t rely on global state.
- Issue
Template - A GitHub issue template with title, body, and labels.
- NoOutput
- A no-op output implementation that discards all output.
- Template
File - A template loaded from a static string (typically from
include_str!
).
Enums§
- Hyperlink
Mode - Controls how hyperlinks are displayed in terminal output.
Traits§
- Output
- Trait for outputting bug report information in no_std environments.
Functions§
- create_
terminal_ hyperlink - Create a clickable terminal hyperlink using ANSI escape sequences.
- extract_
placeholders - Extract placeholder names from template content.
- generate_
github_ url - Generate a GitHub issue URL using the global configuration (std only).
- get_
hyperlink_ mode - Get the hyperlink mode from the global configuration (std only).
- init
- Initialize a bug report configuration builder (std only).
- init_
handle - Initialize a bug report handle (works in both std and no_std).
- supports_
hyperlinks - Detect if the current terminal supports clickable hyperlinks (std only).
Type Aliases§
- FxHash
Map - A fast HashMap implementation using FxHasher.