feat: update tabled
This commit is contained in:
@@ -7,25 +7,81 @@ struct Language {
|
|||||||
invented_year: usize,
|
invented_year: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
#[derive(Tabled)]
|
||||||
let languages = vec![
|
struct TagData {
|
||||||
Language{
|
tag: String,
|
||||||
name: "C",
|
description: String,
|
||||||
designed_by: "Dennis Ritchie",
|
alive: usize,
|
||||||
invented_year: 1972
|
total: usize,
|
||||||
},
|
uploaded: String,
|
||||||
Language{
|
downloaded: String,
|
||||||
name: "Rust",
|
up_speed: String,
|
||||||
designed_by: "Graydon Hoare",
|
down_speed: String,
|
||||||
invented_year: 2010
|
}
|
||||||
},
|
|
||||||
Language{
|
fn main() {
|
||||||
name: "Go",
|
let languages = vec![
|
||||||
designed_by: "Rob Pike",
|
Language {
|
||||||
invented_year: 2009
|
name: "C",
|
||||||
},
|
designed_by: "Dennis Ritchie",
|
||||||
];
|
invented_year: 1972,
|
||||||
|
},
|
||||||
let table = Table::new(languages).to_string();
|
Language {
|
||||||
println!("{}", table);
|
name: "Rust",
|
||||||
|
designed_by: "Graydon Hoare",
|
||||||
|
invented_year: 2010,
|
||||||
|
},
|
||||||
|
Language {
|
||||||
|
name: "Go",
|
||||||
|
designed_by: "Rob Pike",
|
||||||
|
invented_year: 2009,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
let table = Table::new(languages).to_string();
|
||||||
|
println!("{}", table);
|
||||||
|
|
||||||
|
let table2 = Table::new(vec![
|
||||||
|
TagData {
|
||||||
|
tag: "0.0.0.0:9901".into(),
|
||||||
|
description: "47.--.--.--:3443".into(),
|
||||||
|
alive: 0,
|
||||||
|
total: 10,
|
||||||
|
uploaded: "1.11MB".into(),
|
||||||
|
downloaded: "1.11MB".into(),
|
||||||
|
up_speed: "0/s".into(),
|
||||||
|
down_speed: "0/s".into(),
|
||||||
|
},
|
||||||
|
TagData {
|
||||||
|
tag: "0.0.0.0:9902".into(),
|
||||||
|
description: "47.---.--.--:2443".into(),
|
||||||
|
alive: 0,
|
||||||
|
total: 2294,
|
||||||
|
uploaded: "26.28MB".into(),
|
||||||
|
downloaded: "828.52MB".into(),
|
||||||
|
up_speed: "100/s".into(),
|
||||||
|
down_speed: "476/s".into(),
|
||||||
|
},
|
||||||
|
TagData {
|
||||||
|
tag: "0.0.0.0:9909".into(),
|
||||||
|
description: "47.---.--.--:9909".into(),
|
||||||
|
alive: 22,
|
||||||
|
total: 19776,
|
||||||
|
uploaded: "254.50MB".into(),
|
||||||
|
downloaded: "4.38GB".into(),
|
||||||
|
up_speed: "1.83KB/s".into(),
|
||||||
|
down_speed: "36.09KB/s".into(),
|
||||||
|
},
|
||||||
|
TagData {
|
||||||
|
tag: "<total>".into(),
|
||||||
|
description: "-".into(),
|
||||||
|
alive: 22,
|
||||||
|
total: 22182,
|
||||||
|
uploaded: "281.91MB".into(),
|
||||||
|
downloaded: "5.24GB".into(),
|
||||||
|
up_speed: "1.83KB/s".into(),
|
||||||
|
down_speed: "36.09KB/s".into(),
|
||||||
|
},
|
||||||
|
]).to_string();
|
||||||
|
println!("{}", table2);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user