Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. #[derive(Debug)]
  2. struct Foo(u32);
  3.  
  4.  
  5. impl Foo {
  6. fn succ(self) -> Self {
  7. Self(self.0 + 1)
  8. }
  9. }
  10.  
  11. fn main() {
  12. (0..4).fold(
  13. Foo(0),
  14. |f, _| {
  15. println!("{:?}",f);
  16. f.succ()
  17. },
  18. );
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement