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.
lazyImport
Build.lazyImport
pubinlinefnlazyImport(
b: *Build,
/// The build.zig struct of the package importing the dependency./// When calling this function from the `build` function of a build.zig file's, you normally/// pass `@This()`.comptimeasking_build_zig: type,
comptimedep_name: []constu8,
) ?type
pubinlinefnlazyImport(
b: *Build,
/// The build.zig struct of the package importing the dependency./// When calling this function from the `build` function of a build.zig file's, you normally/// pass `@This()`.comptimeasking_build_zig: type,
comptimedep_name: []constu8,
) ?type {
constbuild_runner = @import("root");
constdeps = build_runner.dependencies;
constpkg_hash = findImportPkgHashOrFatal(b, asking_build_zig, dep_name);
inlinefor (@typeInfo(deps.packages).@"struct".decl_names) |decl_name| {
if (comptimemem.eql(u8, decl_name, pkg_hash)) {
constpkg = @field(deps.packages, decl_name);
constavailable = !@hasDecl(pkg, "available") orpkg.available;
if (!available) {
markNeededLazyDep(b, pkg_hash);
returnnull;
}
returnif (@hasDecl(pkg, "build_zig"))
pkg.build_zigelse@compileError("dependency '" ++ dep_name ++ "' does not have a build.zig");
}
}
comptimeunreachable; // Bad @dependencies source
}