gilt-derive
Procedural macros for the gilt terminal formatting library.
This crate is not useful standalone — enable it via the derive feature
on gilt:
[]
= { = "0.11", = ["derive"] }
Provided derives
| Derive | Generates | Use case |
|---|---|---|
Table |
to_table(items: &[Self]) -> gilt::table::Table |
Render a slice of structs as a styled table |
Panel |
to_panel(&self) -> gilt::panel::Panel |
Render a struct as a labelled panel |
Tree |
to_tree(&self) -> gilt::tree::Tree |
Render a struct as a hierarchical tree |
Columns |
to_columns(items: &[Self]) -> gilt::columns::Columns |
Multi-column flow layout |
Rule |
to_rule(&self) -> gilt::rule::Rule |
Section divider with title |
Inspect |
to_inspect(&self) -> impl Renderable |
Debug-style introspection widget |
Renderable |
impl gilt::console::Renderable for Self |
Wire any struct into the rendering pipeline |
Quick example
use Table;
let employees = vec!;
let table = to_table;
See docs.rs/gilt-derive for the full
attribute schemas and examples in the main repo
(derive_*.rs).
Robustness
As of v0.11.2, all gilt-derive macros emit compile_error! (never panic)
on malformed input. Errors carry source spans so IDEs highlight the
offending attribute, not the derive macro itself.
License
MIT — see LICENSE.