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 › Cache › HashHelper › add Public Function add Doc Source Public Function std.Build.Cache.HashHelper.add
pub fn add (hh : *HashHelper , x : anytype ) void Params File Build/Cache.zig: 224
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264 pub fn add (hh : *HashHelper , x : anytype ) void {
switch (@TypeOf (x )) {
std .SemanticVersion => {
hh .add (x .major );
hh .add (x .minor );
hh .add (x .patch );
},
std .Target .Os .TaggedVersionRange => {
switch (x ) {
.hurd => |hurd | {
hh .add (hurd .range .min );
hh .add (hurd .range .max );
hh .add (hurd .glibc );
},
.linux => |linux | {
hh .add (linux .range .min );
hh .add (linux .range .max );
hh .add (linux .glibc );
hh .add (linux .android );
},
.windows => |windows | {
hh .add (windows .min );
hh .add (windows .max );
},
.semver => |semver | {
hh .add (semver .min );
hh .add (semver .max );
},
.none => {},
}
},
std .zig .BuildId => switch (x ) {
.none , .fast , .uuid , .sha1 , .md5 => hh .add (std .meta .activeTag (x )),
.hexstring => |hex_string | hh .addBytes (hex_string .toSlice ()),
},
else => switch (@typeInfo (@TypeOf (x ))) {
.bool , .int , .@"enum" , .array => hh .addBytes (mem .asBytes (&x )),
else => @compileError ("unable to hash type " ++ @typeName (@TypeOf (x ))),
},
}
}
Convert the input value into bytes and record it as a dependency of the process being cached.