struct Counter { value: i32, step: i32, } impl Counter { fn bump(&mut self) { self.value += self.step; } fn get(&self) -> i32 { self.value } } fn main() { let mut c = Counter { value: 0, step: 3 }; c.bump(); c.bump(); println!("{}", c.get()); }