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.
pubfntmpDir(opts: Io.Dir.OpenOptions) TmpDir {
comptimeassert(builtin.is_test);
varrandom_bytes: [TmpDir.random_bytes_count]u8 = undefined;
io.random(&random_bytes);
varsub_path: [TmpDir.sub_path_len]u8 = undefined;
_ = std.base64.url_safe.Encoder.encode(&sub_path, &random_bytes);
constcwd = Io.Dir.cwd();
varcache_dir = cwd.createDirPathOpen(io, ".zig-cache", .{}) catch@panic("unable to make tmp dir for testing: unable to make and open .zig-cache dir");
defercache_dir.close(io);
constparent_dir = cache_dir.createDirPathOpen(io, "tmp", .{}) catch@panic("unable to make tmp dir for testing: unable to make and open .zig-cache/tmp dir");
constdir = parent_dir.createDirPathOpen(io, &sub_path, .{ .open_options = opts }) catch@panic("unable to make tmp dir for testing: unable to make and open the tmp dir");
return .{
.dir = dir,
.parent_dir = parent_dir,
.sub_path = sub_path,
};
}