$cargorun--exampletableMovieIMDbRatingTheShawshankRedemption9.2TheGodfather9.1TheGodfather:PartII9.0$catexamples/table.rs1externcratemodern_terminal;23usemodern_terminal::{4components::{5table::{Size,Table},6text::{Text,TextAlignment},7},8core::{console::Console,style::Style},9};1011fnmain()->std::io::Result<()>{12letmutwriter=std::io::stdout();13letmutconsole=Console::from_fd(&mutwriter);1415letcomponent=Table{16column_sizes:vec![Size::Cells(25),Size::Cells(13)],17rows:vec![18vec![header("Movie"),header("IMDbRating")],19vec![movie("TheShawshankRedemption"),rating("9.2")],20vec![movie("TheGodfather"),rating("9.1")],21vec![movie("TheGodfather:PartII"),rating("9.0")],22],23};2425console.render(&component)?;2627Ok(())28}2930fnheader(text:&str)->Box<Text>{31Box::new(Text{32align:TextAlignment::Center,33text:String::from(text),34styles:vec![Style::Bold,Style::Foreground("yellow".to_string())],35})36}3738fnmovie(text:&str)->Box<Text>{39Box::new(Text{40align:TextAlignment::Left,41text:String::from(text),42styles:vec![Style::Foreground("cyan".to_string())],43})44}4546fnrating(text:&str)->Box<Text>{47Box::new(Text{48align:TextAlignment::Center,49text:String::from(text),50styles:vec![Style::Foreground("bright_green".to_string())],51})52}