Guest User

Untitled

a guest
Jul 18th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. struct Foo {
  2. n: u32,
  3. }
  4.  
  5. impl Foo {
  6. fn bar(&mut self) {
  7. println!("{}", self.n)
  8. }
  9. }
  10.  
  11. struct Caller<F, G: FnMut(&mut F)> {
  12. f: G,
  13. _ghost: std::marker::PhantomData<F>
  14. }
  15.  
  16. fn main() {
  17. let f = Foo { n: 100 };
  18. let c = Caller::<Foo, _>{ f: |f| f.bar(), _ghost: std::marker::PhantomData };
  19. }
Add Comment
Please, Sign In to add comment