aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/outputs-spec.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-11 11:54:43 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-11 19:08:19 -0500
commit114a6e2b09eda7f23e7776e1cdf77715044e073e (patch)
tree34a3a255f4543925fff023160bde3789b8071e64 /src/libstore/outputs-spec.cc
parent8a3b1b7ced3e00d29a0274dde110801dea4a1e0e (diff)
Make it hard to construct an empty `OutputsSpec::Names`
This should be a non-empty set, and so we don't want people doing this by accident. We remove the zero-0 constructor with a little inheritance trickery.
Diffstat (limited to 'src/libstore/outputs-spec.cc')
-rw-r--r--src/libstore/outputs-spec.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstore/outputs-spec.cc b/src/libstore/outputs-spec.cc
index e7bd8ebd8..891252990 100644
--- a/src/libstore/outputs-spec.cc
+++ b/src/libstore/outputs-spec.cc
@@ -32,7 +32,7 @@ std::optional<OutputsSpec> OutputsSpec::parseOpt(std::string_view s)
return { OutputsSpec::All {} };
if (match[2].matched)
- return { tokenizeString<OutputsSpec::Names>(match[2].str(), ",") };
+ return OutputsSpec::Names { tokenizeString<StringSet>(match[2].str(), ",") };
assert(false);
}
@@ -139,11 +139,11 @@ void to_json(nlohmann::json & json, const ExtendedOutputsSpec & extendedOutputsS
void from_json(const nlohmann::json & json, OutputsSpec & outputsSpec)
{
- auto names = json.get<OutputNames>();
- if (names == OutputNames({"*"}))
+ auto names = json.get<StringSet>();
+ if (names == StringSet({"*"}))
outputsSpec = OutputsSpec::All {};
else
- outputsSpec = names;
+ outputsSpec = OutputsSpec::Names { std::move(names) };
}