Function esp_idf_svc::sys::nvs_entry_find

source ·
pub unsafe extern "C" fn nvs_entry_find(
    part_name: *const i8,
    namespace_name: *const i8,
    type_: u32,
    output_iterator: *mut *mut nvs_opaque_iterator_t,
) -> i32
Expand description

@brief Create an iterator to enumerate NVS entries based on one or more parameters

\code{c} // Example of listing all the key-value pairs of any type under specified partition and namespace nvs_iterator_t it = NULL; esp_err_t res = nvs_entry_find(<nvs_partition_name>, , NVS_TYPE_ANY, &it); while(res == ESP_OK) { nvs_entry_info_t info; nvs_entry_info(it, &info); // Can omit error check if parameters are guaranteed to be non-NULL printf(“key ‘%s’, type ‘%d’ \n”, info.key, info.type); res = nvs_entry_next(&it); } nvs_release_iterator(it); \endcode

@param[in] part_name Partition name

@param[in] namespace_name Set this value if looking for entries with a specific namespace. Pass NULL otherwise.

@param[in] type One of nvs_type_t values.

@param[out] output_iterator Set to a valid iterator to enumerate all the entries found. Set to NULL if no entry for specified criteria was found. If any other error except ESP_ERR_INVALID_ARG occurs, \c output_iterator is NULL, too. If ESP_ERR_INVALID_ARG occurs, \c output_iterator is not changed. If a valid iterator is obtained through this function, it has to be released using \c nvs_release_iterator when not used any more, unless ESP_ERR_INVALID_ARG is returned.

@return - ESP_OK if no internal error or programming error occurred. - ESP_ERR_NVS_NOT_FOUND if no element of specified criteria has been found. - ESP_ERR_NO_MEM if memory has been exhausted during allocation of internal structures. - ESP_ERR_INVALID_ARG if any of the parameters is NULL. Note: don’t release \c output_iterator in case ESP_ERR_INVALID_ARG has been returned