Module table

Module table 

Source
Expand description

Styled table rendering for Oxur tools

Provides a flexible table builder with TOML-based theming for terminal output.

§Examples

§Basic Usage

use oxur_cli::table::{OxurTable, Tabled};

#[derive(Tabled)]
struct Employee {
    #[tabled(rename = "Name")]
    name: String,
    #[tabled(rename = "Age")]
    age: u32,
    #[tabled(rename = "Role")]
    role: String,
}

let employees = vec![
    Employee { name: "Alice".into(), age: 30, role: "Engineer".into() },
    Employee { name: "Bob".into(), age: 25, role: "Designer".into() },
];

let table = OxurTable::new(employees).render();
println!("{}", table);
use oxur_cli::table::{OxurTable, Tabled};

#[derive(Tabled)]
struct Row {
    #[tabled(rename = "ID")]
    id: u32,
    #[tabled(rename = "Name")]
    name: String,
}

let data = vec![
    Row { id: 1, name: "Alice".into() },
    Row { id: 2, name: "Bob".into() },
];

let table = OxurTable::new(data)
    .with_title("USER LIST")
    .with_footer()
    .render();
println!("{}", table);

Re-exports§

pub use config::TableStyleConfig;

Modules§

config
helpers
Helper functions for advanced table styling

Structs§

Builder
Builder creates a Table from dynamic data set.
Cell
Cell denotes a particular cell on a Table.
OxurTable
A themed table builder for terminal output
TabledColor
Color represents a color which can be set to things like Border, Padding and Margin.

Traits§

Tabled
Tabled a trait responsible for providing a header fields and a row fields.

Derive Macros§

Tabled