Skip to content

Commit 240a9cb

Browse files
committed
Make addFilePost* functions' documentation more clear
1 parent 00c19e6 commit 240a9cb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/std/cache_hash.zig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,11 @@ pub const CacheHash = struct {
258258
}
259259

260260
/// Add a file as a dependency of process being cached, after the initial hash has been
261-
/// calculated. Returns the contents of the file, allocated with the given allocator.
261+
/// calculated. This is useful for processes that don't know the all the files that
262+
/// are depended on ahead of time. For example, a source file that can import other files
263+
/// will need to be recompiled if the imported file is changed.
264+
///
265+
/// Returns the contents of the file, allocated with the given allocator.
262266
pub fn addFilePostFetch(self: *@This(), otherAlloc: *mem.Allocator, file_path: []const u8) ![]u8 {
263267
debug.assert(self.manifest_file != null);
264268

@@ -269,7 +273,9 @@ pub const CacheHash = struct {
269273
}
270274

271275
/// Add a file as a dependency of process being cached, after the initial hash has been
272-
/// calculated.
276+
/// calculated. This is useful for processes that don't know the all the files that
277+
/// are depended on ahead of time. For example, a source file that can import other files
278+
/// will need to be recompiled if the imported file is changed.
273279
pub fn addFilePost(self: *@This(), file_path: []const u8) !void {
274280
const contents = try self.addFilePostFetch(self.alloc, file_path);
275281
self.alloc.free(contents);

0 commit comments

Comments
 (0)