Skip to content

Commit 4a3800d

Browse files
NicoElbersandrewrk
authored andcommitted
std.ArrayHashMap fix eql documentation
In cf88cf2 the eql function provided in The context of ArrayHashMap was changed to also include the key index, but this wasn't properly updated in the documentation. Since a flat `usize` is unintuitive, I've tried to explain the function of the parameter as best I can based on the original commit. Finally, I didn't do an extensive search if this eql definition is incorrectly stated anywhere outside of these 2 spots. But I somewhat doubt an file outside of `array_hash_map` would
1 parent 3670910 commit 4a3800d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/std/array_hash_map.zig

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ pub fn ArrayHashMapWithAllocator(
8080
comptime V: type,
8181
/// A namespace that provides these two functions:
8282
/// * `pub fn hash(self, K) u32`
83-
/// * `pub fn eql(self, K, K) bool`
83+
/// * `pub fn eql(self, K, K, usize) bool`
8484
///
85+
/// The final `usize` in the `eql` function represents the index of the key
86+
/// that's already inside the map.
8587
comptime Context: type,
8688
/// When `false`, this data structure is biased towards cheap `eql`
8789
/// functions and avoids storing each key's hash in the table. Setting
@@ -525,7 +527,10 @@ pub fn ArrayHashMapUnmanaged(
525527
comptime V: type,
526528
/// A namespace that provides these two functions:
527529
/// * `pub fn hash(self, K) u32`
528-
/// * `pub fn eql(self, K, K) bool`
530+
/// * `pub fn eql(self, K, K, usize) bool`
531+
///
532+
/// The final `usize` in the `eql` function represents the index of the key
533+
/// that's already inside the map.
529534
comptime Context: type,
530535
/// When `false`, this data structure is biased towards cheap `eql`
531536
/// functions and avoids storing each key's hash in the table. Setting

0 commit comments

Comments
 (0)