From 8be14b4d3ea09f8904639bcb64d583c8f3bbbc5a Mon Sep 17 00:00:00 2001 From: Pascal Seitz Date: Thu, 9 Nov 2023 20:22:10 +0800 Subject: [PATCH] add comments --- stacker/src/arena_hashmap.rs | 4 ++++ stacker/src/shared_arena_hashmap.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/stacker/src/arena_hashmap.rs b/stacker/src/arena_hashmap.rs index 4eb5e8a0df..9f3dfbbc50 100644 --- a/stacker/src/arena_hashmap.rs +++ b/stacker/src/arena_hashmap.rs @@ -10,6 +10,10 @@ use crate::shared_arena_hashmap::SharedArenaHashMap; /// The quirky API has the benefit of avoiding /// the computation of the hash of the key twice, /// or copying the key as long as there is no insert. +/// +/// ArenaHashMap is like SharedArenaHashMap but takes ownership +/// of the memory arena. The memory arena stores the serialized +/// keys and values. pub struct ArenaHashMap { shared_arena_hashmap: SharedArenaHashMap, pub memory_arena: MemoryArena, diff --git a/stacker/src/shared_arena_hashmap.rs b/stacker/src/shared_arena_hashmap.rs index 3083fad3e6..6deb39ae27 100644 --- a/stacker/src/shared_arena_hashmap.rs +++ b/stacker/src/shared_arena_hashmap.rs @@ -56,6 +56,10 @@ impl KeyValue { /// The quirky API has the benefit of avoiding /// the computation of the hash of the key twice, /// or copying the key as long as there is no insert. +/// +/// SharedArenaHashMap is like ArenaHashMap but does the memory arena +/// gets passed as an argument to the methods. +/// So one MemoryArena can be shared with multiple SharedArenaHashMap. pub struct SharedArenaHashMap { table: Vec, mask: usize,