We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5f7dfc3 commit 1e0739fCopy full SHA for 1e0739f
lib/std/enums.zig
@@ -55,7 +55,7 @@ pub fn values(comptime E: type) []const E {
55
/// A safe alternative to @tagName() for non-exhaustive enums that doesn't
56
/// panic when `e` has no tagged value.
57
/// Returns the tag name for `e` or null if no tag exists.
58
-pub fn tagName(comptime E: type, e: E) ?[]const u8 {
+pub fn tagName(comptime E: type, e: E) ?[:0]const u8 {
59
return inline for (@typeInfo(E).@"enum".fields) |f| {
60
if (@intFromEnum(e) == f.value) break f.name;
61
} else null;
0 commit comments