pub inline fn hasFn(comptime T: type, comptime name: []const u8) bool T: typename: []const u8840
841
842
843
844
845
846
847
848
849pub inline fn hasFn(comptime T: type, comptime name: []const u8) bool {
switch (@typeInfo(T)) {
.@"struct", .@"union", .@"enum", .@"opaque" => {},
else => return false,
}
if (!@hasDecl(T, name))
return false;
return @typeInfo(@TypeOf(@field(T, name))) == .@"fn";
}