Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn callee<F>(f: F)
- where F: FnOnce() + Send + 'static,
- {
- f();
- }
- fn caller(s: &str) {
- callee(move || println!("{}", s));
- }
- fn main() {
- let s = "hello"; // In real code this comes from another function that doesn't give us 'static str
- caller(s);
- }
Add Comment
Please, Sign In to add comment