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<F, G: FnMut(&mut F)> {
- f: G,
- _ghost: std::marker::PhantomData<F>
- }
- fn main() {
- let f = Foo { n: 100 };
- let c = Caller::<Foo, _>{ f: |f| f.bar(), _ghost: std::marker::PhantomData };
- }
Add Comment
Please, Sign In to add comment