Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Foo {
- n: u32,
- }
- impl Foo {
- fn bar(&mut self) {
- println!("{}", self.n)
- }
- }
- struct Caller<T> {
- data: T,
- f: fn(T),
- }
- fn main() {
- let mut foo = Foo { n: 100 };
- let c = Caller { data: &mut foo, f: Foo::bar, };
- }
Add Comment
Please, Sign In to add comment