-
-
Save rust-play/8121c9afb99fc74b7a67716f3ed38d83 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
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 add<F>(v: &mut Vec<F>, f: F) { | |
v.push(f); | |
} | |
fn hoge(i: i32) -> i32 { | |
i + 1 | |
} | |
fn fuga(i: i32) -> i32 { | |
i * 2 | |
} | |
fn main() { | |
let mut v = vec![]; | |
add(&mut v, hoge); | |
add(&mut v, fuga); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment