Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Part1 {
- points: u32
- }
- impl Part1 {
- fn new() -> Part1 {
- Part1 { points: 30 }
- }
- fn points<'a>(&'a mut self, points: u32) -> &'a mut Self {
- self.points = points;
- self
- }
- fn run(&self) {
- println!("{:?}", self.points);
- }
- }
- fn main() {
- let mut p = Part1::new().points(11);
- p.run();
- p.points(5);
- p.run();
- }
Add Comment
Please, Sign In to add comment