[][src]Function dqcsim::bindings::dqcs_pdef_set_allocate_cb

#[no_mangle]pub extern "C" fn dqcs_pdef_set_allocate_cb(
    pdef: dqcs_handle_t,
    callback: Option<extern "C" fn(user_data: *mut c_void, state: dqcs_plugin_state_t, qubits: dqcs_handle_t, alloc_cmds: dqcs_handle_t) -> dqcs_return_t>,
    user_free: Option<extern "C" fn(user_data: *mut c_void)>,
    user_data: *mut c_void
) -> dqcs_return_t

Sets the qubit allocation callback for operators and backends.

The default for operators is to pass through to dqcs_plugin_allocate(). The default for backends is no-op. This callback is never called for frontend plugins.

Besides the common arguments, the callback receives a handle to a qubit set containing the references that are to be used for the to-be-allocated qubits and an ArbCmd queue containing user-defined commands to optionally augment the behavior of the qubits. These are borrowed handles; the caller will delete them.

The callback can return an error by setting an error message using dqcs_error_set() and returning DQCS_FAILURE. Otherwise, it should return DQCS_SUCCESS.