StaticStringMap
Static string map optimized for small sets of disparate string keys. Works by separating the keys by length at initialization and only checking strings of equal length at runtime.
Fields of this type
Fields
- kvs:*const KVs
- = &empty_kvs
- len_indexes:[*]const u32
- = &empty_len_indexes
- len_indexes_len:u32
- = 0
- min_len:u32
- = std.math.maxInt(u32)
- max_len:u32
- = 0
Type definitions in this namespace
Types
Returns a map backed by static, comptime allocated memory.
Functions
- initComptime
- Returns a map backed by static, comptime allocated memory.
- init
- Returns a map backed by memory allocated with `allocator`.
- deinit
- this method should only be used with init() and not with initComptime().
- has
- Checks if the map has a value for the key.
- get
- Returns the value for the key if any, else null.
- getLongestPrefix
- Returns the key-value pair where key is the longest prefix of `str`
Source
Implementation
pub fn StaticStringMap(comptime V: type) type {
return StaticStringMapWithEql(V, defaultEql);
}