From b0c78e81255377476ec8743af533ae84ad2d3936 Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi Date: Mon, 27 Jul 2020 17:31:23 +0600 Subject: [PATCH] Add setters to GameHighScore --- src/types/game_high_score.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/types/game_high_score.rs b/src/types/game_high_score.rs index 2d59ae8c..f713b18e 100644 --- a/src/types/game_high_score.rs +++ b/src/types/game_high_score.rs @@ -17,3 +17,24 @@ pub struct GameHighScore { /// Score. pub score: u32, } + +impl GameHighScore { + pub fn new(position: u32, user: User, score: u32) -> Self { + Self { position, user, score } + } + + pub fn position(mut self, val: u32) -> Self { + self.position = val; + self + } + + pub fn user(mut self, val: User) -> Self { + self.user = val; + self + } + + pub fn score(mut self, val: u32) -> Self { + self.score = val; + self + } +}