[][src]Function esp_idf_bindgen::nvs_get_used_entry_count

pub unsafe extern "C" fn nvs_get_used_entry_count(
    handle: nvs_handle_t,
    used_entries: *mut size_t
) -> esp_err_t

@brief Calculate all entries in a namespace.

Note that to find out the total number of records occupied by the namespace, add one to the returned value used_entries (if err is equal to ESP_OK). Because the name space entry takes one entry.

\code{c} // Example of nvs_get_used_entry_count() to get amount of all key-value pairs in one namespace: nvs_handle_t handle; nvs_open("namespace1", NVS_READWRITE, &handle); ... size_t used_entries; size_t total_entries_namespace; if(nvs_get_used_entry_count(handle, &used_entries) == ESP_OK){ // the total number of records occupied by the namespace total_entries_namespace = used_entries + 1; } \endcode

@param[in] handle Handle obtained from nvs_open function.

@param[out] used_entries Returns amount of used entries from a namespace.

@return - ESP_OK if the changes have been written successfully. Return param used_entries will be filled valid value. - ESP_ERR_NVS_NOT_INITIALIZED if the storage driver is not initialized. Return param used_entries will be filled 0. - ESP_ERR_NVS_INVALID_HANDLE if handle has been closed or is NULL. Return param used_entries will be filled 0. - ESP_ERR_INVALID_ARG if used_entries equal to NULL. - Other error codes from the underlying storage driver. Return param used_entries will be filled 0.