Function qdk_sim::c_api::get_noise_model_by_name [−][src]
#[no_mangle]
pub extern "C" fn get_noise_model_by_name(
name: *const c_char,
noise_model_json: *mut *const c_char
) -> i64
Expand description
Gets the noise model corresponding to a particular name, serialized as a string representing a JSON object.
Currently recognized names:
ideal
ideal_stabilizer
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:
name
is a pointer to a null-terminated string of Unicode characters, encoded as UTF-8, and that the pointer remains valid for the lifetime of this call.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.