Advertisement
cwchen

[Rust] Creature class

Sep 3rd, 2017
3,278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.35 KB | None | 0 0
  1. pub struct Creature {
  2.     priority: i32,
  3.     // Other fields omitted.
  4. }
  5.  
  6. impl Creature {
  7.     pub fn new() -> Creature {
  8.         Creature{ priority: 0 }
  9.     }
  10. }
  11.  
  12. impl Priority for Creature {
  13.      fn get_priority(&self) -> i32 {
  14.          self.priority
  15.      }
  16.  
  17.      fn set_priority(&mut self, value: i32) {
  18.          self.priority = value;
  19.      }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement