Function pact_ffi::models::provider::pactffi_provider_get_name

source ·
#[no_mangle]
pub extern "C" fn pactffi_provider_get_name(
    provider: *const Provider,
) -> *const c_char
Expand description

Get a copy of this provider’s name.

The copy must be deleted with pactffi_string_delete.

§Usage

// Assuming `file_name` and `json_str` are already defined.

MessagePact *message_pact = pactffi_message_pact_new_from_json(file_name, json_str);
if (message_pact == NULLPTR) {
    // handle error.
}

Provider *provider = pactffi_message_pact_get_provider(message_pact);
if (provider == NULLPTR) {
    // handle error.
}

char *name = pactffi_provider_get_name(provider);
if (name == NULL) {
    // handle error.
}

printf("%s\n", name);

pactffi_string_delete(name);

§Errors

This function will fail if it is passed a NULL pointer, or the Rust string contains an embedded NULL byte. In the case of error, a NULL pointer will be returned.