Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. macro_rules! defer {
  2. ($c:expr, $i:ident( $( $x:expr ),* )) => {{
  3. $c.defer(|c| $i(c $(, $x)*));
  4. }}
  5. }
  6. struct Core {}
  7. impl Core {
  8. fn defer<F>(&mut self, _f: F) where F: FnOnce(&mut Core) + 'static {}
  9. }
  10. fn test(_core: &mut Core, _v1: i32, _v2: i32) {}
  11. fn main() {
  12. let mut core = Core {};
  13. defer!(&mut core, test(1, 2));
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement