aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-01-31 22:25:49 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-01-31 22:25:49 -0700
commit75bbc74d56f26da812c47436c6f5712d3cfde12d (patch)
treec243bba0c998f3f44afe5e67f1120433117d5ead /lib/std/meta.zig
parentaa326328d0b4a0d4ee8167be9b2ab25fd560b0c9 (diff)
downloadzig-75bbc74d56f26da812c47436c6f5712d3cfde12d.tar.gz
zig-75bbc74d56f26da812c47436c6f5712d3cfde12d.zip
a small crusade against std.meta.declarations
Diffstat (limited to 'lib/std/meta.zig')
-rw-r--r--lib/std/meta.zig2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index 8e270654b8..72a073fbfb 100644
--- a/lib/std/meta.zig
+++ b/lib/std/meta.zig
@@ -361,6 +361,8 @@ test "std.meta.containerLayout" {
try testing.expect(containerLayout(U3) == .Extern);
}
+/// Instead of this function, prefer to use e.g. `@TypeInfo(foo).Struct.decls`
+/// directly when you know what kind of type it is.
pub fn declarations(comptime T: type) []const TypeInfo.Declaration {
return switch (@typeInfo(T)) {
.Struct => |info| info.decls,