mirror of
https://github.com/NixOS/nix.git
synced 2025-11-20 17:29:36 +01:00
WIP more progress
This commit is contained in:
parent
da39092a39
commit
754c910953
6 changed files with 28 additions and 25 deletions
|
|
@ -24,4 +24,22 @@ std::string makeFixedOutputCA(FileIngestionMethod method, const Hash & hash)
|
|||
+ hash.to_string();
|
||||
}
|
||||
|
||||
template<class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
|
||||
template<class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
|
||||
|
||||
std::string renderContentAddress(ContentAddress ca) {
|
||||
return std::visit(overloaded {
|
||||
[](TextHash th) {
|
||||
return "text:" + th.hash.to_string();
|
||||
},
|
||||
[](FileSystemHash fsh) {
|
||||
return makeFixedOutputCA(fsh.method, fsh.hash);
|
||||
}
|
||||
}, ca);
|
||||
}
|
||||
|
||||
std::string renderContentAddress(std::optionalContent<Address> ca) {
|
||||
return ca ? renderContentAddress(*ca) else "";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue