You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@memberTag(comptime T: type, index: usize) -> (error set or enum value from T)
Example of how it works:
@memberTag(enum { A, B, C }, 1) // returns B
@memberTag(error { D, E, F }, 1) // returns E
Idk what the use case is for having it work for enums, but the use case for error sets was mentioned here.
The text was updated successfully, but these errors were encountered:
andrewrk
added
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
accepted
This proposal is planned.
labels
Feb 9, 2018
Now that I think of it, I think this is accomplished by:
@field(T, @memberName(T, index))
So I'll implement @field instead.
andrewrk
changed the title
Have buildin function for getting the tag value of enums and error sets.
@field builtin function to do field access with a comptime string as the field name
Feb 11, 2018
Add following builtin function:
Example of how it works:
Idk what the use case is for having it work for enums, but the use case for error sets was mentioned here.
The text was updated successfully, but these errors were encountered: