Function add [src]

Convert the input value into bytes and record it as a dependency of the process being cached.

Prototype

pub fn add(hh: *HashHelper, x: anytype) void

Parameters

hh: *HashHelper

Source

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))), }, } }