fix: print all lines correctly and set title

This commit is contained in:
Daniel Alejandro Gallegos 2023-11-12 19:29:59 -05:00
parent e7bdc9c8a3
commit a176e62ef4
Signed by: taco
GPG key ID: 5A09E616957C4F12

View file

@ -16,14 +16,15 @@ struct Emails {
} }
fn main() { fn main() {
println!("Preeeeow, world.");
let the_paper = include_str!("sbemails.toml"); let the_paper = include_str!("sbemails.toml");
let sbemails: Sbemails = toml::from_str(the_paper) let sbemails: Sbemails = toml::from_str(the_paper)
.expect("failed to deserialize sbemails.toml"); .expect("failed to deserialize sbemails.toml");
let mut random_number = thread_rng(); let mut random_number = thread_rng();
let sbemail = sbemails.emails.choose(&mut random_number).unwrap(); let sbemail = sbemails.emails.choose(&mut random_number).unwrap();
println!("sbemail number: {:?}", sbemail.number); println!("sbemail #{}: {}", sbemail.number, sbemail.title);
println!("sbemail title: {:?}", sbemail.title); let sbemail_content = sbemail.content.split("\n");
println!("sbemail content: {:?}", sbemail.content); for part in sbemail_content {
println!("{}", part);
}
} }