MCPcopy Create free account
hub / github.com/SSheldon/rust-dispatch / context_and_function

Function context_and_function

src/lib.rs:91–102  ·  view source on GitHub ↗
(closure: F)

Source from the content-addressed store, hash-verified

89}
90
91fn context_and_function<F>(closure: F) -> (*mut c_void, dispatch_function_t)
92 where F: FnOnce() {
93 extern fn work_execute_closure<F>(context: Box<F>) where F: FnOnce() {
94 (*context)();
95 }
96
97 let closure = Box::new(closure);
98 let func: extern fn(Box<F>) = work_execute_closure::<F>;
99 unsafe {
100 (mem::transmute(closure), mem::transmute(func))
101 }
102}
103
104fn context_and_sync_function<F>(closure: &mut Option<F>) ->
105 (*mut c_void, dispatch_function_t)

Callers 5

exec_asyncMethod · 0.85
notifyMethod · 0.85
exec_asyncMethod · 0.85
exec_afterMethod · 0.85
barrier_asyncMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected