Guest User

Untitled

a guest
Dec 13th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. fn callee<F>(f: F)
  2. where F: FnOnce() + Send + 'static,
  3. {
  4. f();
  5. }
  6.  
  7.  
  8. fn caller(s: &str) {
  9. callee(move || println!("{}", s));
  10. }
  11.  
  12. fn main() {
  13. let s = "hello"; // In real code this comes from another function that doesn't give us 'static str
  14.  
  15. caller(s);
  16. }
Add Comment
Please, Sign In to add comment