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 › Manifest › addPrefixedPathPostContents Public Function addPrefixedPathPostContents Doc Source Public Function std.Build.Cache.Manifest.addPrefixedPathPostContents
pub fn addPrefixedPathPostContents (
man : *Manifest ,
prefixed_path : PrefixedPath ,
bytes : []const u8 ,
stat : File .Stat ,
) !bool Params File Build/Cache.zig: 1050
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087 pub fn addPrefixedPathPostContents (
man : *Manifest ,
prefixed_path : PrefixedPath ,
bytes : []const u8 ,
stat : File .Stat ,
) !bool {
const gpa = man .cache .gpa ;
const gop = try man .files .getOrPutAdapted (gpa , prefixed_path , FilesAdapter {});
errdefer _ = man .files .pop ();
if (gop .found_existing ) return false ;
const new_file = gop .key_ptr ;
new_file .* = .{
.prefixed_path = prefixed_path ,
.max_file_size = null ,
.handle = null ,
.stat = stat ,
.bin_digest = undefined ,
.contents = null ,
};
if (try man .isProblematicTimestamp (new_file .stat .mtime )) {
// The actual file has an unreliable timestamp, force it to be hashed
new_file .stat .mtime = .zero ;
new_file .stat .inode = 0 ;
}
{
var hasher = hasher_init ;
hasher .update (bytes );
hasher .final (&new_file .bin_digest );
}
man .hash .hasher .update (&new_file .bin_digest );
return true ;
}
Low level function.
prefixed_pathreferences cloned memory. Returns whether or notprefixed_path.sub_pathshould be kept.