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 › standardOptimizeOption Public Function standardOptimizeOption Doc Source 1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223 pub fn standardOptimizeOption (b : *Build , options : StandardOptimizeOptionOptions ) std .builtin .Optimize {
const graph = b .graph ;
if (options .preferred_optimize_mode ) |mode | {
if (b .option (bool , "release" , "optimize for end users" ) orelse (graph .release_mode != .off )) {
return mode ;
} else {
return .debug ;
}
}
if (b .option (
std .builtin .Optimize ,
"optimize" ,
"Prioritize performance, safety, or binary size" ,
)) |mode | {
return mode ;
}
return switch (graph .release_mode ) {
.off => .debug ,
.any => {
std .debug .print ("the project does not declare a preferred optimization mode. choose: --release=fast, --release=safe, or --release=small\n" , .{});
process .exit (1 );
},
.fast => .fast ,
.safe => .safe ,
.small => .small ,
};
}