-
Notifications
You must be signed in to change notification settings - Fork 6
Meta type ‣ isArgumentClampedArray(T, arg_index)
Chung Leong edited this page Oct 25, 2025
·
1 revision
Determine whether an argument to a callback function should be a U8ClampedArray.
Usage:
const std = @import("std");
const Callback = fn ([]const u8) void;
pub fn call(cb: *const Callback) void {
cb("hello");
}
const module = @This();
pub const @"meta(zigar)" = struct {
pub fn isArgumentClampedArray(comptime T: type, comptime arg_index: usize) bool {
return T == Callback and arg_index == 0;
}
};import { call } from './meta-type-clamped-array-example-3.zig';
call(arg => console.log(arg));Uint8ClampedArray(5) [ 104, 101, 108, 108, 111 ]
Arguments:
-
T- Callback function type -
arg_index- Index of argument in question