Skip to content

Commit

Permalink
Restore alphabet example
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiburt committed Aug 5, 2024
1 parent 72220a1 commit 41a18aa
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions tabled/examples/alphabet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,11 @@
//! * Note how [`Range`] [expression syntax](https://doc.rust-lang.org/reference/expressions/range-expr.html)
//! is used to idiomatically represent the English alphabet.

fn main() {
use tabled::{
settings::{Alignment, Style},
Table,
};

let movies = vec![
("The Fall Guy", 2024, 6.9),
("Barbie", 2023, 6.8),
("The Chase for Carrera", 2023, 7.5),
];
use std::iter::FromIterator;

let mut table = Table::new(movies);
table.with((Alignment::right(), Style::modern()));
use tabled::Table;

assert_eq!(
table.to_string(),
"┌───────────────────────┬──────┬─────┐\n\
│ &str │ i32 │ f64 │\n\
├───────────────────────┼──────┼─────┤\n\
│ The Fall Guy │ 2024 │ 6.9 │\n\
├───────────────────────┼──────┼─────┤\n\
│ Barbie │ 2023 │ 6.8 │\n\
├───────────────────────┼──────┼─────┤\n\
│ The Chase for Carrera │ 2023 │ 7.5 │\n\
└───────────────────────┴──────┴─────┘",
);
fn main() {
let table = Table::from_iter(['a'..='z']);
println!("{table}");
}

0 comments on commit 41a18aa

Please sign in to comment.