SHARE
TWEET

Untitled

a guest Apr 21st, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top