diff options
| author | LemonBoy <thatlemon@gmail.com> | 2020-11-26 13:19:30 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-01-02 17:12:57 -0700 |
| commit | 1c13ca5a05978011283ff55a586443b10b69fc85 (patch) | |
| tree | 30a411c8e359467ba520d3f8e68ebf8500aceffa /lib/std/meta | |
| parent | dd973fb365dbbe11ce5beac8b4889bfab3fddc4d (diff) | |
| download | zig-1c13ca5a05978011283ff55a586443b10b69fc85.tar.gz zig-1c13ca5a05978011283ff55a586443b10b69fc85.zip | |
stage2: Use {s} instead of {} when formatting strings
Diffstat (limited to 'lib/std/meta')
| -rw-r--r-- | lib/std/meta/trait.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/std/meta/trait.zig b/lib/std/meta/trait.zig index 8c8b26cf45..8e54293533 100644 --- a/lib/std/meta/trait.zig +++ b/lib/std/meta/trait.zig @@ -298,6 +298,20 @@ pub fn isNumber(comptime T: type) bool { }; } +pub fn isIntegerNumber(comptime T: type) bool { + return switch (@typeInfo(T)) { + .Int, .ComptimeInt => true, + else => false, + }; +} + +pub fn isFloatingNumber(comptime T: type) bool { + return switch (@typeInfo(T)) { + .Float, .ComptimeFloat => true, + else => false, + }; +} + test "std.meta.trait.isNumber" { const NotANumber = struct { number: u8, |
