Advertisement
cwchen

[Rust] The (private) setters of Point class

Aug 28th, 2017
3,584
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.21 KB | None | 0 0
  1. impl Point {
  2.     // Setter for x, private
  3.     fn set_x(&mut self, x: f64) {
  4.         self.x = x;
  5.     }
  6. }
  7.  
  8. impl Point {
  9.     // Setter for y, private
  10.     fn set_y(&mut self, y: f64) {
  11.         self.y = y;
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement