Skip to content

Commit

Permalink
Make addFilePost* functions' documentation more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
leroycep committed Apr 15, 2020
1 parent 00c19e6 commit 240a9cb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/std/cache_hash.zig
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,11 @@ pub const CacheHash = struct {
}

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

Expand All @@ -269,7 +273,9 @@ pub const CacheHash = struct {
}

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

0 comments on commit 240a9cb

Please sign in to comment.