1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
pub mod tomorrow_study { pub struct Content { pub name: String, pub author: String, pub id: String, pub url: String, } pub struct Category { pub cont: [Content; 2], } pub fn List(cont_type: Category) { let mut i = 0; println!("| Name | Author | ID |"); while i < cont_type.cont.len() { println!( "| {} | {} | {} |", cont_type.cont[i].name, cont_type.cont[i].author, cont_type.cont[i].id ); i += 1; } } }