aboutsummaryrefslogtreecommitdiff
path: root/src/util.zig
diff options
context:
space:
mode:
authorNic Gaffney <gaffney_nic@protonmail.com>2026-02-18 16:47:14 -0600
committerNic Gaffney <gaffney_nic@protonmail.com>2026-02-18 16:47:14 -0600
commitd872eceeb6f082abeb3a41d8e1f6e9db53ec7a6e (patch)
tree7025db320ffa1f5e42055ec73d02b2fb6a6e7af8 /src/util.zig
parent813b6631de7aa296c23e2471589d66625aa6ce15 (diff)
downloadfuncz-d872eceeb6f082abeb3a41d8e1f6e9db53ec7a6e.tar.gz
Added fnInput and fnOutput
Diffstat (limited to 'src/util.zig')
-rw-r--r--src/util.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util.zig b/src/util.zig
index 8de989e..6046264 100644
--- a/src/util.zig
+++ b/src/util.zig
@@ -14,3 +14,11 @@ pub fn typeVerify(T: type, expected: anytype) Type {
@compileError("Expected one of " ++ @tagName(e) ++ ", found " ++ @typeName(T));
return realTypeInfo;
}
+
+pub inline fn fnInput(f: anytype) type {
+ return typeVerify(@TypeOf(f), .{ .@"fn" }).@"fn".params[0].type.?;
+}
+
+pub inline fn fnOutput(f: anytype) type {
+ return typeVerify(@TypeOf(f), .{ .@"fn" }).@"fn".return_type.?;
+}