Function values [src]
Returns the set of all named values in the given enum, in
declaration order.
Prototype
pub fn values(comptime E: type) []const E
Parameters
E: type
Example
test values {
const E = enum {
X,
Y,
Z,
const A = 1;
};
try testing.expectEqualSlices(E, &.{ .X, .Y, .Z }, values(E));
}
Source
pub fn values(comptime E: type) []const E {
return comptime valuesFromFields(E, @typeInfo(E).@"enum".fields);
}