# (`static_table`) Cook tables at compiler time The library provides a macros to build a pretty tables at compile time. There's 2 types of tables you can build. 1. Standard adjusted tables (`static_table::static_table`). 2. Not adjusted, floating tables (`static_table::pool_table`). To find a more features and settings which you can use with the macros please check out the documentation ([docs.rs](https://docs.rs/static_table)). ## Get started Add the library to your `Cargo.toml`. ```toml # Cargo.toml [dependencies] static_table = "0.2" ``` An example of `static_table` usage.
Example | Result |
---|---|
```rust use static_table::static_table; static LANG_LIST: &str = static_table!([ ["name", "designed by", "first release"], ["C", "Dennis Ritchie", "1972"], ["Go", "Rob Pike", "2009"], ["Rust", "Graydon Hoare", "2010"], ["Hare", "Drew DeVault", "2022"], ]); fn main() { println!("{LANG_LIST}") } ``` | ```text +------+----------------+---------------+ | name | designed by | first release | +------+----------------+---------------+ | C | Dennis Ritchie | 1972 | +------+----------------+---------------+ | Go | Rob Pike | 2009 | +------+----------------+---------------+ | Rust | Graydon Hoare | 2010 | +------+----------------+---------------+ | Hare | Drew DeVault | 2022 | +------+----------------+---------------+ ``` |
Example | Result |
---|---|
```rust use static_table::pool_table; static LANG_LIST: &str = pool_table!([ ["name", "designed by", "first release"], ["C", "Dennis Ritchie", "1972"], ["Go", "Rob Pike", "2009"], ["Rust", "Graydon Hoare", "2010"], ["Hare", "Drew DeVault", "2022"], ]); fn main() { println!("{LANG_LIST}") } ``` | ```text +------+-------------+---------------+ | name | designed by | first release | +------+-------------+-----+---------+ | C | Dennis Ritchie | 1972 | +------+--+---------------++---------+ | Go | Rob Pike | 2009 | +---------+---------------+-+--------+ | Rust | Graydon Hoare | 2010 | +---------+-----------------+--------+ | Hare | Drew DeVault | 2022 | +---------+-----------------+--------+ ``` |