documentation for mutable HashMap KV pointers

master
Josh Wolfe 2019-12-07 13:22:23 -05:00
parent edebe0586b
commit 05fc4d34a9
1 changed files with 5 additions and 0 deletions

View File

@ -42,6 +42,11 @@ pub fn HashMap(comptime K: type, comptime V: type, comptime hash: fn (key: K) u3
const Self = @This();
/// A *KV is a mutable pointer into this HashMap's internal storage.
/// Modifying the key is undefined behavior.
/// Modifying the value is harmless.
/// *KV pointers become invalid whenever this HashMap is modified,
/// and then any access to the *KV is undefined behavior.
pub const KV = struct {
key: K,
value: V,