Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent
commodo cursus magna, vel scelerisque nisl consectetur et. Maecenas
faucibus mollis interdum; a record is useful when each value has a clear
name and a predictable place.
This Rust example stores a small record and formats a readable summary.
struct Note {
title: String,
words: usize,
}
fn summary(note: &Note) -> String {
format!("{} ({} words)", note.title, note.words)
}
let note = Note {
title: String::from("Lorem Ipsum"),
words: 5,
};
println!("{}", summary(¬e));