1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-12 20:11:03 +01:00

"newtype" BuildableReq

This makes for better types errors and allows us to give it methods.
This commit is contained in:
John Ericson 2021-04-05 09:24:42 -04:00
parent 4fe41c6db3
commit 9dfb97c987
8 changed files with 24 additions and 16 deletions

View file

@ -28,14 +28,22 @@ struct BuildableReqFromDrv {
static BuildableReqFromDrv parse(const Store & store, std::string_view);
};
using BuildableReq = std::variant<
using _BuildableReqRaw = std::variant<
BuildableOpaque,
BuildableReqFromDrv
>;
std::string to_string(const Store & store, const BuildableReq &);
struct BuildableReq : _BuildableReqRaw {
using Raw = _BuildableReqRaw;
using Raw::Raw;
BuildableReq parseBuildableReq(const Store & store, std::string_view);
inline const Raw & raw() const {
return static_cast<const Raw &>(*this);
}
std::string to_string(const Store & store) const;
static BuildableReq parse(const Store & store, std::string_view);
};
struct BuildableFromDrv {
StorePath drvPath;