DoxigAlpha

StringHashMap

Builtin hashmap for strings as keys. Key memory is managed by the caller. Keys and values will not automatically be freed.

Fields of this type

Fields

#
ctx:Context

Create a managed hash map with an empty context.

Functions

#
init
Create a managed hash map with an empty context.
initContext
Create a managed hash map with a context
lockPointers
Puts the hash map into a state where any method call that would
unlockPointers
Undoes a call to `lockPointers`.
deinit
Release the backing array and invalidate this map.
clearRetainingCapacity
Empty the map, but keep the backing allocation for future use.
clearAndFree
Empty the map and release the backing allocation.
count
Return the number of items in the map.
iterator
Create an iterator over the entries in the map.
keyIterator
Create an iterator over the keys in the map.
valueIterator
Create an iterator over the values in the map.
getOrPut
If key exists this function cannot fail.
getOrPutAdapted
If key exists this function cannot fail.
getOrPutAssumeCapacity
If there is an existing item with `key`, then the result's
getOrPutAssumeCapacityAdapted
If there is an existing item with `key`, then the result's
ensureTotalCapacity
Increases capacity, guaranteeing that insertions up until the
ensureUnusedCapacity
Increases capacity, guaranteeing that insertions up until
capacity
Returns the number of total elements which may be present before it is
put
Clobbers any existing data.
putNoClobber
Inserts a key-value pair into the hash map, asserting that no previous
putAssumeCapacity
Asserts there is enough capacity to store the new key-value pair.
putAssumeCapacityNoClobber
Asserts there is enough capacity to store the new key-value pair.
fetchPut
Inserts a new `Entry` into the hash map, returning the previous one, if any.
fetchPutAssumeCapacity
Inserts a new `Entry` into the hash map, returning the previous one, if any.
fetchRemove
Removes a value from the map and returns the removed kv pair.
get
Finds the value associated with a key in the map
getKey
Finds the actual key associated with an adapted key in the map
getEntry
Finds the key and value associated with a key in the map
contains
Check if the map contains a key
remove
If there is an `Entry` with a matching key, it is deleted from
removeAdapted
TODO: answer the question in these doc comments, does this
removeByPtr
Delete the entry with key pointed to by key_ptr from the hash map.
clone
Creates a copy of this map, using the same allocator
cloneWithAllocator
Creates a copy of this map, using a specified allocator
cloneWithContext
Creates a copy of this map, using a specified context
cloneWithAllocatorAndContext
Creates a copy of this map, using a specified allocator and context.
move
Set the map to an empty state, making deinitialization a no-op, and
rehash
Rehash the map, in-place.

An entry, containing pointers to a key and value stored in the map

Values

#
Entry
An entry, containing pointers to a key and value stored in the map
KV
A copy of a key and value which are no longer in the map
Hash
The integer type that is the result of hashing
Iterator
The iterator type returned by iterator()
KeyIterator
= Unmanaged.KeyIterator
ValueIterator
= Unmanaged.ValueIterator
Size
The integer type used to store the size of the map
GetOrPutResult
The type returned from getOrPut and variants

Source

Implementation

#