Skip to content

Commit 05fc4d3

Browse files
committed
documentation for mutable HashMap KV pointers
1 parent edebe05 commit 05fc4d3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/std/hash_map.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ pub fn HashMap(comptime K: type, comptime V: type, comptime hash: fn (key: K) u3
4242

4343
const Self = @This();
4444

45+
/// A *KV is a mutable pointer into this HashMap's internal storage.
46+
/// Modifying the key is undefined behavior.
47+
/// Modifying the value is harmless.
48+
/// *KV pointers become invalid whenever this HashMap is modified,
49+
/// and then any access to the *KV is undefined behavior.
4550
pub const KV = struct {
4651
key: K,
4752
value: V,

0 commit comments

Comments
 (0)