Zig 0.17.0-dev (Split by item)
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.
Zig › std/ › Build.zig › Dependency
Dependency
Build.Dependency
pub const Dependency = struct
File
Code
pub const Dependency = struct {
builder : *Build ,
pub fn artifact (d : *Dependency , name : []const u8 ) *Step .Compile {
var found : ?*Step .Compile = null ;
for (d .builder .install_tls .step .dependencies .items ) |dep_step | {
const inst = dep_step .cast (Step .InstallArtifact ) orelse continue ;
if (mem .eql (u8 , inst .artifact .name , name )) {
if (found != null ) panic ("artifact name {q} is ambiguous" , .{name });
found = inst .artifact ;
}
}
return found orelse {
for (d .builder .install_tls .step .dependencies .items ) |dep_step | {
const inst = dep_step .cast (Step .InstallArtifact ) orelse continue ;
log .info ("available artifact: {q}" , .{inst .artifact .name });
}
panic ("unable to find artifact {q}" , .{name });
};
}
pub fn module (d : *Dependency , name : []const u8 ) *Module {
return d .builder .modules .get (name ) orelse {
panic ("unable to find module {q}" , .{name });
};
}
pub fn namedWriteFiles (d : *Dependency , name : []const u8 ) *Step .WriteFile {
return d .builder .named_writefiles .get (name ) orelse {
panic ("unable to find named writefiles {q}" , .{name });
};
}
pub fn namedLazyPath (d : *Dependency , name : []const u8 ) LazyPath {
return d .builder .named_lazy_paths .get (name ) orelse {
panic ("unable to find named lazypath {q}" , .{name });
};
}
pub fn path (d : *Dependency , sub_path : []const u8 ) LazyPath {
return .{
.dependency = .{
.dependency = d ,
.sub_path = sub_path ,
},
};
}
}