This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.
CheckAllAllocationFailuresExtraArgs
testing.CheckAllAllocationFailuresExtraArgs
fnCheckAllAllocationFailuresExtraArgs(comptimeTestFn: type) type
fnCheckAllAllocationFailuresExtraArgs(comptimeTestFn: type) type {
switch (@typeInfo(@typeInfo(TestFn).@"fn".return_type.?)) {
.error_union => |info| {
if (info.payload != void) {
@compileError("Return type must be !void");
}
},
else => @compileError("Return type must be !void"),
}
constArgsTuple = std.meta.ArgsTuple(TestFn);
constfield_types = @typeInfo(ArgsTuple).@"struct".field_types;
if (field_types.len == 0orfield_types[0] != std.mem.Allocator) {
@compileError("The provided function must have an " ++ @typeName(std.mem.Allocator) ++ " as its first argument");
}
varextra_args: [field_types.len - 1]type = undefined;
for (&extra_args, field_types[1..]) |*arg, field_type| {
arg.* = field_type;
}
return@Tuple(&extra_args);
}