Skip to content

Instantly share code, notes, and snippets.

View amuxtux's full-sized avatar

Amit Singhai amuxtux

  • Bangalore, India
View GitHub Profile
@amuxtux
amuxtux / gist:4076837
Created November 15, 2012 05:38 — forked from eevee/gist:3970206
passing a rust function as a C callback
extern fn status_foreach_callback(path: *c_char, stat: c_uint, payload: *c_void) -> c_int unsafe {
let path_str = str::raw::from_c_str(path);
let f: *fn(&str, uint) = cast::reinterpret_cast(&payload);
(*f)(path_str, stat as uint);
return 0;
}
// ...