Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #[derive(Clone)]
  2. struct Score{
  3. score: f64,
  4. }
  5. fn main() {
  6. let mut my_array:Vec<Option<Score>>= vec![None;5000];
  7. my_array[0]= Some(Score{score:0.5});
  8. println!("{}",my_array[0].as_ref().unwrap().score);
  9. my_array[0].as_mut().unwrap().score= 100.0;
  10. println!("{}",my_array[0].as_ref().unwrap().score);
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement