1pub struct Player {
2 pub name: String,
3 pub score: i32,
4}
5
6impl Player {
7 pub fn new(name: String, score: i32) -> Player {
8 Player { name, score }
9 }
10
11 pub fn describe(&self) -> String {
12 format!("{} has scored: {}", self.name, self.score)
13 }
14}