Expand description
§FFI compatible callbacks
The essence of them is to be simple, reliable, and flexible. Thus, every callback accepts a C
function that takes 2 arguments: context, and argument.
context is any type of context. We take a sized pointer to it. It can hold anything like a
closure that we then wrap for callback functionality.
argument is the actual argument that gets produced and passed over. This will be variable,
and it is passed as value.
OpaqueCallback, as the name suggests, marks the context as opaque, casts it to c_void
pointer. It allows the code not to care about what’s behind the context, it just knows that it
needs to pass it over to the callback.