Function qdk_sim::c_api::get_noise_model[][src]

#[no_mangle]
pub extern "C" fn get_noise_model(
    sim_id: usize,
    noise_model_json: *mut *const c_char
) -> i64
Expand description

Returns the currently configured noise model for a given simulator, serialized as a string representing a JSON object.

Safety

As this is a C-language API, the Rust compiler cannot guarantee safety when calling into this function. The caller is responsible for ensuring that:

  • noise_model_json is a valid pointer whose lifetime extends for the duration of this function call.

After this call completes, this function guarantees that either of the two conditions below holds:

  • The return value is negative, in which case calling lasterr will return an actionable error message, or
  • The return value is 0, and *noise_model_json is a valid pointer to a null-terminated string of Unicode characters, encoded as UTF-8. In this case, the caller is considered to own the memory allocated for this string.