pub struct OxurTable<T: Tabled> { /* private fields */ }Expand description
A themed table builder for terminal output
Creates tables with the default Oxur theme (warm orange sunset colors).
Supports any data type that implements Tabled.
Implementations§
Source§impl<T: Tabled> OxurTable<T>
impl<T: Tabled> OxurTable<T>
Sourcepub fn new(data: Vec<T>) -> Self
pub fn new(data: Vec<T>) -> Self
Create a new table with data, using the default Oxur theme
§Examples
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);Sourcepub fn render(self) -> String
pub fn render(self) -> String
Render the table as a styled string for terminal output
§Examples
use oxur_cli::table::{OxurTable, Tabled};
#[derive(Tabled)]
struct Row {
name: String,
}
let data = vec![Row { name: "Test".into() }];
let output = OxurTable::new(data).render();
println!("{}", output);Auto Trait Implementations§
impl<T> Freeze for OxurTable<T>
impl<T> RefUnwindSafe for OxurTable<T>where
T: RefUnwindSafe,
impl<T> Send for OxurTable<T>where
T: Send,
impl<T> Sync for OxurTable<T>where
T: Sync,
impl<T> Unpin for OxurTable<T>where
T: Unpin,
impl<T> UnwindSafe for OxurTable<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more