Guest User

Untitled

a guest
Jun 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. struct Test {
  2. y: f32
  3. }
  4.  
  5. impl Test {
  6. fn get_y(&mut self) -> &mut f32 {
  7. &mut self.y
  8. }
  9. }
  10.  
  11. fn main() {
  12. let mut test = Test { y: 100.0 };
  13.  
  14. let y = test.get_y();
  15.  
  16. println!("y: {:?}", y);
  17. }
Add Comment
Please, Sign In to add comment