Last active
January 18, 2020 20:04
-
-
Save metaleap/151dc7fbcf73f7073800af189ebdfc85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub inline fn isStr(comptime it: type) bool { | |
return switch (@typeInfo(it)) { | |
std.builtin.TypeId.Array => |ta| u8 == ta.child, | |
std.builtin.TypeId.Pointer => |tp| u8 == tp.child or switch (@typeInfo(tp.child)) { | |
std.builtin.TypeId.Array => |tpa| u8 == tpa.child, | |
else => false, | |
}, | |
else => false, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment