fn ComptimeStringMap(comptime V: type, comptime kvs_list: anytype) type

Comptime string map optimized for small sets of disparate string keys. Works by separating the keys by length at comptime and only checking strings of equal length at runtime.

kvs_list expects a list of struct { []const u8, V } (key-value pair) tuples. You can pass struct { []const u8 } (only keys) tuples if V is void.

Parameters

V: type,
kvs_list: anytype,

Functions

fn get(str: []const u8) ?V

Returns the value for the key if any, else null.

fn has(str: []const u8) bool

Checks if the map has a value for the key.

Values

kvs
undefined

Array of struct { key: []const u8, value: V } where value is void{} if V