yyjson_obj_iter_getn

Function yyjson_obj_iter_getn 

Source
pub unsafe extern "C" fn yyjson_obj_iter_getn(
    iter: *mut yyjson_obj_iter,
    key: *const c_char,
    key_len: usize,
) -> *mut yyjson_val
Expand description

Iterates to a specified key and returns the value.

This function does the same thing as yyjson_obj_getn(), but is much faster if the ordering of the keys is known at compile-time and you are using the same order to look up the values. If the key exists in this object, then the iterator will stop at the next key, otherwise the iterator will not change and NULL is returned.

@param iter The object iterator, should not be NULL. @param key The key, should be a UTF-8 string, null-terminator is not required. @param key_len The the length of key, in bytes. @return The value to which the specified key is mapped. NULL if this object contains no mapping for the key or input is invalid.

@warning This function takes a linear search time if the key is not nearby.