Guest User

Untitled

a guest
Nov 20th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. trait FnBox {
  2. fn call_box(self: Box<Self>);
  3. }
  4.  
  5. impl<F: FnOnce() + ?Sized> FnBox for F {
  6. fn call_box(self: Box<F>) {
  7. (*self)()
  8. }
  9. }
  10.  
  11. fn main() {
  12. let x = "test".to_string();
  13. let f = Box::new(move || { x; });
  14. f.call_box();
  15. }
Add Comment
Please, Sign In to add comment