Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Debug)]
- struct Foo(u32);
- impl Foo {
- fn succ(self) -> Self {
- Self(self.0 + 1)
- }
- }
- fn main() {
- (0..4).fold(
- Foo(0),
- |f, _| {
- println!("{:?}",f);
- f.succ()
- },
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement