Meta type ‣ isDeclClampedArray(T, name) ᴾᴴᴾ - chung-leong/zigar GitHub Wiki
JavaScript | PHP
Determine whether a decl should be a U8ClampedArray.
Usage:
const std = @import("std");
pub const declaration: []const u8 = "hello";
const module = @This();
pub const @"meta(zigar)" = struct {
pub fn isDeclClampedArray(comptime T: type, comptime name: std.meta.DeclEnum(T)) bool {
return T == module and name == .declaration;
}
};
<?php
$m = zigar_use(__DIR__ . '/meta-type-clamped-array-example-1.zig');
print_r($m->declaration);
Uint8ClampedArray Object
(
[ITEMS](/chung-leong/zigar/wiki/ITEMS) => Array
(
[0] => 104
[1] => 101
[2] => 108
[3] => 108
[4] => 111
)
[buffer] => ArrayBuffer Object
(
[byteLength] => 5
[detached] =>
[readOnly] => 1
)
[byteLength] => 5
[byteOffset] => 0
[length] => 5
)
Arguments:
T:type- Namespace containing the declname:std.meta.DeclEnum(T): - Name of the decl represented by an enum