authorgravatar for wrongnull@gmail.comBogdan Romanyuk <wrongnull@gmail.com> 2023-04-22 13:55:30+03:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-04-22 13:55:30+03:00
logb22155d352b2f9499596f50b42b86032bcbf168d
treeb16b02283e8f50fc394289428d1f38baa037655f
parentdbdafb6cc503ce5820713dfa79cc956438b7957a
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Add doc comments for ComptimeStringMap

Some parts of stdlib are still undocumented yet.

1 files changed, 4 insertions(+), 0 deletions(-)

lib/std/comptime_string_map.zig+4
......@@ -50,12 +50,16 @@ pub fn ComptimeStringMap(comptime V: type, comptime kvs_list: anytype) type {
5050 };
5151
5252 return struct {
53 /// Array of `struct { key: []const u8, value: V }` where `value` is `void{}` if `V` is `void`.
54 /// Sorted by `key` length.
5355 pub const kvs = precomputed.sorted_kvs;
5456
57 /// Checks if the map has a value for the key.
5558 pub fn has(str: []const u8) bool {
5659 return get(str) != null;
5760 }
5861
62 /// Returns the value for the key if any, else null.
5963 pub fn get(str: []const u8) ?V {
6064 if (str.len < precomputed.min_len or str.len > precomputed.max_len)
6165 return null;