6 releases (breaking)
| 0.9.0 | Feb 10, 2026 |
|---|---|
| 0.8.0 | Feb 9, 2026 |
| 0.7.0 | Feb 9, 2026 |
| 0.6.0 | Feb 9, 2026 |
| 0.1.0 | Feb 8, 2026 |
#16 in #terminal-formatting
Used in gilt
150KB
3.5K
SLoC
Derive macros for the gilt terminal formatting library.
This crate provides the #[derive(Table)], #[derive(Panel)], #[derive(Tree)],
#[derive(Columns)], #[derive(Rule)], #[derive(Inspect)], and #[derive(Renderable)] macros that generate widget
conversion methods and trait implementations for structs.
Table Example
use gilt::Table;
#[derive(Table)]
#[table(title = "Employees", box_style = "ROUNDED", header_style = "bold cyan")]
struct Employee {
#[column(header = "Full Name", style = "bold")]
name: String,
#[column(justify = "right")]
age: u32,
#[column(skip)]
internal_id: u64,
#[column(header = "Dept", style = "green", min_width = 10)]
department: String,
}
let employees = vec![
Employee {
name: "Alice".into(),
age: 30,
internal_id: 1001,
department: "Engineering".into(),
},
Employee {
name: "Bob".into(),
age: 25,
internal_id: 1002,
department: "Marketing".into(),
},
];
let table = Employee::to_table(&employees);
Panel Example
use gilt::Panel;
#[derive(Panel)]
#[panel(title = "Server Status", box_style = "ROUNDED", border_style = "blue")]
struct ServerStatus {
#[field(label = "Host", style = "bold cyan")]
name: String,
#[field(label = "CPU %", style = "yellow")]
cpu: f32,
#[field(skip)]
internal_id: u64,
#[field(label = "Memory", style = "green")]
memory: f32,
}
let status = ServerStatus {
name: "web-01".into(),
cpu: 42.5,
internal_id: 1001,
memory: 67.3,
};
let panel = status.to_panel();
Dependencies
~125–500KB
~12K SLoC