Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. trait Foo
  2. {
  3.  
  4. }
  5.  
  6. struct Bar
  7. {
  8. capacity_hint : usize
  9. }
  10.  
  11. impl Foo for Bar
  12. {
  13.  
  14. }
  15.  
  16. fn main()
  17. {
  18. let mut factories : Vec<Box<Fn() -> Box<Foo>>> = Vec::new();
  19. let capacity_hint : usize = 10;
  20.  
  21. factories.push(Box::new(||
  22. {
  23. Box::new(Bar {capacity_hint })
  24. }));
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement