That the struct Stroke is used in RoundScore, which is used in Scorecard. It worked fine until now, that I have to copy the RoundScore struct.
pub fn get_player_score(&self, player: &Player, round: i64) -> RoundScore {
.
.
.
if let Some(score) = player_card.scored.get(&round) {
return *score; // do I have to clone here?
} else {
return RoundScore::new();
}
}
That does not work, because Copy is not implemented for Flightpath and thus RoundScore. Rust is fairly new to me and I feel a bit lost, since I have no idea how to go about this.
PS:
I need the functions to render areas within those functions, or flight paths described by a function.
This may or may not work depending on what functions you put inside it. Only some functions can be stored with an fn(f64) -> f64. If that doesn't work, you can change the Box to Arc, which makes it possible to clone the function.
However if you take this route, you must use score.clone() rather than *score because cloning an Arc requires incrementing a counter, since an Arc keeps track of how many clones of it there are.