Created
September 18, 2017 08:41
-
-
Save mgsloan/f728ae5bb502518c242972b35c136f63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let mut x = 1; | |
wat(|i| { x += i; return x; }); | |
println!("{}", x); | |
} | |
fn wat<F>(f: F) -> u32 where F: FnMut(u32) -> u32 { | |
foo(f) | |
} | |
fn foo<F>(mut f: F) -> u32 where F: FnMut(u32) -> u32 { | |
f(1) + f(2) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment