Hi, I've created a simple game of life and I've a few questions.
https://github.com/stachujone5/game-of-life/blob/main/src/main.rs
get_rowmethod - Why can't I return just an owned[bool]and instaed I've to return a reference?
fn get_row(&self, index: usize) -> &[bool] {
&self.cells[index * self.size..index * self.size + self.size]
}
printmethod - I am getting a&boolinside a map. Can I somehow check if&boolis true? I didn't figure it out so I usedto_owned()
.map(|v| if v.to_owned() { " # " } else { " . " })
- Are there any major issues in my code when It comes to borrowing and references? I've a hard time understanding it.