mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Deprecate std.enums.nameCast.
This commit is contained in:
parent
6c598e8341
commit
530228d953
1 changed files with 1 additions and 2 deletions
|
|
@ -197,8 +197,7 @@ test "directEnumArrayDefault slice" {
|
||||||
try testing.expectEqualSlices(u8, "default", array[2]);
|
try testing.expectEqualSlices(u8, "default", array[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Cast an enum literal, value, or string to the enum value of type E
|
/// Deprecated: Use @field(E, @tagName(tag)) or @field(E, string)
|
||||||
/// with the same name.
|
|
||||||
pub fn nameCast(comptime E: type, comptime value: anytype) E {
|
pub fn nameCast(comptime E: type, comptime value: anytype) E {
|
||||||
return comptime blk: {
|
return comptime blk: {
|
||||||
const V = @TypeOf(value);
|
const V = @TypeOf(value);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue