mirror of
https://github.com/NixOS/nix
synced 2025-07-03 06:11:46 +02:00
Merge remote-tracking branch 'upstream/master' into indexed-store-path-outputs
This commit is contained in:
commit
b18720ee17
137 changed files with 4190 additions and 1583 deletions
|
@ -36,7 +36,9 @@ const std::optional<ExperimentalFeature> parseExperimentalFeature(const std::str
|
|||
|
||||
std::string_view showExperimentalFeature(const ExperimentalFeature feature)
|
||||
{
|
||||
return stringifiedXpFeatures.at(feature);
|
||||
const auto ret = get(stringifiedXpFeatures, feature);
|
||||
assert(ret);
|
||||
return *ret;
|
||||
}
|
||||
|
||||
std::set<ExperimentalFeature> parseFeatures(const std::set<std::string> & rawFeatures)
|
||||
|
@ -59,4 +61,20 @@ std::ostream & operator <<(std::ostream & str, const ExperimentalFeature & featu
|
|||
return str << showExperimentalFeature(feature);
|
||||
}
|
||||
|
||||
void to_json(nlohmann::json & j, const ExperimentalFeature & feature)
|
||||
{
|
||||
j = showExperimentalFeature(feature);
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json & j, ExperimentalFeature & feature)
|
||||
{
|
||||
const std::string input = j;
|
||||
const auto parsed = parseExperimentalFeature(input);
|
||||
|
||||
if (parsed.has_value())
|
||||
feature = *parsed;
|
||||
else
|
||||
throw Error("Unknown experimental feature '%s' in JSON input", input);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue