Instead of this function, prefer to use e.g. @typeInfo(foo).@"struct".decl_names
directly when you know what kind of type it is.
pub fn declarations(comptime T: type) []const [:0]const u8
pub fn declarations(comptime T: type) []const [:0]const u8 {
return switch (@typeInfo(T)) {
.@"struct" => |info| info.decl_names,
.@"enum" => |info| info.decl_names,
.@"union" => |info| info.decl_names,
.@"opaque" => |info| info.decl_names,
else => @compileError("Expected struct, enum, union, or opaque type, found '" ++ @typeName(T) ++ "'"),
};
}