Guest User

Untitled

a guest
Jul 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 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<T> {
  12. data: T,
  13. f: fn(T),
  14. }
  15.  
  16. fn main() {
  17. let mut foo = Foo { n: 100 };
  18. let c = Caller { data: &mut foo, f: Foo::bar, };
  19. }
Add Comment
Please, Sign In to add comment