Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- macro_rules! defer {
- ($c:expr, $i:ident( $( $x:expr ),* )) => {{
- $c.defer(|c| $i(c $(, $x)*));
- }}
- }
- struct Core {}
- impl Core {
- fn defer<F>(&mut self, _f: F) where F: FnOnce(&mut Core) + 'static {}
- }
- fn test(_core: &mut Core, _v1: i32, _v2: i32) {}
- fn main() {
- let mut core = Core {};
- defer!(&mut core, test(1, 2));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement