diff options
| author | Bogdan Romanyuk <65823030+wrongnull@users.noreply.github.com> | 2023-04-22 13:55:30 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-22 13:55:30 +0300 |
| commit | b22155d352b2f9499596f50b42b86032bcbf168d (patch) | |
| tree | b16b02283e8f50fc394289428d1f38baa037655f /lib/std/comptime_string_map.zig | |
| parent | dbdafb6cc503ce5820713dfa79cc956438b7957a (diff) | |
| download | zig-b22155d352b2f9499596f50b42b86032bcbf168d.tar.gz zig-b22155d352b2f9499596f50b42b86032bcbf168d.zip | |
Add doc comments for ComptimeStringMap
Some parts of stdlib are still undocumented yet.
Diffstat (limited to 'lib/std/comptime_string_map.zig')
| -rw-r--r-- | lib/std/comptime_string_map.zig | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/std/comptime_string_map.zig b/lib/std/comptime_string_map.zig index 267259225c..7620ec7af8 100644 --- a/lib/std/comptime_string_map.zig +++ b/lib/std/comptime_string_map.zig @@ -50,12 +50,16 @@ pub fn ComptimeStringMap(comptime V: type, comptime kvs_list: anytype) type { }; return struct { + /// Array of `struct { key: []const u8, value: V }` where `value` is `void{}` if `V` is `void`. + /// Sorted by `key` length. pub const kvs = precomputed.sorted_kvs; + /// Checks if the map has a value for the key. pub fn has(str: []const u8) bool { return get(str) != null; } + /// Returns the value for the key if any, else null. pub fn get(str: []const u8) ?V { if (str.len < precomputed.min_len or str.len > precomputed.max_len) return null; |
