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 standard library.
std › Build › Step › CheckFile Public Struct CheckFile Doc Source Public Struct Fields Namespaces Structs Values Functions File Build/Step/CheckFile.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 //! Fail the build step if a file does not match certain checks.
const CheckFile = @This ();
const std = @import ("std " );
const Io = std .Io ;
const Step = std .Build .Step ;
const fs = std .fs ;
const mem = std .mem ;
const Configuration = std .Build .Configuration ;
step : Step ,
file : std .Build .LazyPath ,
expected_matches : []const Configuration .Bytes ,
expected_exact : ?Configuration .Bytes ,
max_bytes : ?u32 ,
pub const base_tag : Step .Tag = .check_file ;
pub const Options = struct {
expected_matches : []const []const u8 = &.{},
expected_exact : ?[]const u8 = null ,
max_bytes : ?u32 = null ,
};
pub fn create (owner : *std .Build , file : std .Build .LazyPath , options : Options ) *CheckFile {
const graph = owner .graph ;
const check_file = graph .create (CheckFile );
check_file .* = .{
.step = .init (.{
.tag = base_tag ,
.name = "CheckFile" ,
.owner = owner ,
}),
.file = file .dupe (graph ),
.expected_matches = graph .addBytesList (options .expected_matches ),
.expected_exact = if (options .expected_exact ) |b | graph .addBytes (b ) else null ,
.max_bytes = options .max_bytes ,
};
file .addStepDependencies (&check_file .step );
return check_file ;
}
pub fn setName (check_file : *CheckFile , name : []const u8 ) void {
check_file .step .name = name ;
}
Fail the build step if a file does not match certain checks.