aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta.zig
diff options
context:
space:
mode:
authorTadeo Kondrak <me@tadeo.ca>2021-01-11 10:58:33 -0700
committerVeikka Tuominen <git@vexu.eu>2021-01-30 13:19:52 +0200
commitb7767eb834084adc9db94b9ed961aaa2756fc018 (patch)
tree3c342592d962fe7417f8c79291437d6d564e617f /lib/std/meta.zig
parent68ec54f386d387c5dd3f9dc4f0b5e14be6ae10a6 (diff)
downloadzig-b7767eb834084adc9db94b9ed961aaa2756fc018.tar.gz
zig-b7767eb834084adc9db94b9ed961aaa2756fc018.zip
std.meta: rename TagPayloadType to TagPayload
Diffstat (limited to 'lib/std/meta.zig')
-rw-r--r--lib/std/meta.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index 027b9508e2..9a1215e79b 100644
--- a/lib/std/meta.zig
+++ b/lib/std/meta.zig
@@ -649,9 +649,11 @@ test "std.meta.activeTag" {
testing.expect(activeTag(u) == UE.Float);
}
+const TagPayloadType = TagPayload;
+
///Given a tagged union type, and an enum, return the type of the union
/// field corresponding to the enum tag.
-pub fn TagPayloadType(comptime U: type, tag: @TagType(U)) type {
+pub fn TagPayload(comptime U: type, tag: @TagType(U)) type {
testing.expect(trait.is(.Union)(U));
const info = @typeInfo(U).Union;
@@ -665,14 +667,14 @@ pub fn TagPayloadType(comptime U: type, tag: @TagType(U)) type {
unreachable;
}
-test "std.meta.TagPayloadType" {
+test "std.meta.TagPayload" {
const Event = union(enum) {
Moved: struct {
from: i32,
to: i32,
},
};
- const MovedEvent = TagPayloadType(Event, Event.Moved);
+ const MovedEvent = TagPayload(Event, Event.Moved);
var e: Event = undefined;
testing.expect(MovedEvent == @TypeOf(e.Moved));
}