pub unsafe extern "C" fn aws_hash_table_foreach(
map: *mut aws_hash_table,
callback: Option<unsafe extern "C" fn(context: *mut c_void, p_element: *mut aws_hash_element) -> c_int>,
context: *mut c_void
) -> c_int
Expand description
Iterates through every element in the map and invokes the callback on that item. Iteration is performed in an arbitrary, implementation-defined order, and is not guaranteed to be consistent across invocations.
The callback may change the value associated with the key by overwriting the value pointed-to by value. In this case, the on_element_removed callback will not be invoked, unless the callback invokes AWS_COMMON_HASH_TABLE_ITER_DELETE (in which case the on_element_removed is given the updated value).
The callback must return a bitmask of zero or more of the following values ORed together:
AWS_COMMON_HASH_TABLE_ITER_CONTINUE - Continues iteration to the next
element (if not set, iteration stops)
AWS_COMMON_HASH_TABLE_ITER_DELETE - Deletes the current value and
continues iteration. destroy_fn will NOT be invoked.
AWS_COMMON_HASH_TABLE_ITER_ERROR - Stop iteration with error.
No action will be taken for the current value and the value before this.
No rolling back. The deleted value before will NOT be back.
aws_hash_table_foreach returns AWS_OP_ERR after stropping the iteration.
Invoking any method which may change the contents of the hashtable during iteration results in undefined behavior. However, you may safely invoke non-mutating operations during an iteration.
This operation is mutating only if AWS_COMMON_HASH_TABLE_ITER_DELETE is returned at some point during iteration. Otherwise, it is non-mutating and is safe to invoke in parallel with other non-mutating operations.