[−][src]Function dqcsim::bindings::dqcs_pdef_set_run_cb
#[no_mangle]pub extern "C" fn dqcs_pdef_set_run_cb(
pdef: dqcs_handle_t,
callback: Option<extern "C" fn(user_data: *mut c_void, state: dqcs_plugin_state_t, args: dqcs_handle_t) -> dqcs_handle_t>,
user_free: Option<extern "C" fn(user_data: *mut c_void)>,
user_data: *mut c_void
) -> dqcs_return_t
Sets the run callback for frontends.
This is called in response to a start()
host API call. The return
value is returned through the wait()
host API call.
The default behavior is to fail with a "not implemented" error; frontends backends should always override this. This callback is never called for operator or backend plugins.
Besides the common arguments, the callback receives a handle to an
ArbData
object containing the data that the host passed to start()
.
This is a borrowed handle; the caller will delete it.
When the run callback is successful, it should return a valid ArbData
handle. This can be the same as the argument, but it can also be a new
object. This ArbData
is returned to the host through wait()
. This
ArbData
object is deleted after the callback completes.
The callback can return an error by setting an error message using
dqcs_error_set()
and returning 0. Otherwise, it should return a
valid ArbData
handle.