aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/outputs-spec.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-11 17:31:32 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-11 19:09:21 -0500
commit0faf5326bd333eeef126730683dc02009a06402f (patch)
treedc5158b88bd44fc7cc97e67f07802cbd45220a49 /src/libstore/outputs-spec.hh
parent5ba6e5d0d9bed2806ddb59c8a3305b3cb5784d53 (diff)
Improve tests for `OutputsSpec`
Diffstat (limited to 'src/libstore/outputs-spec.hh')
-rw-r--r--src/libstore/outputs-spec.hh9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/libstore/outputs-spec.hh b/src/libstore/outputs-spec.hh
index babf29d16..9211a4fc6 100644
--- a/src/libstore/outputs-spec.hh
+++ b/src/libstore/outputs-spec.hh
@@ -25,9 +25,7 @@ struct OutputNames : std::set<std::string> {
OutputNames() = delete;
};
-struct AllOutputs {
- bool operator < (const AllOutputs & _) const { return false; }
-};
+struct AllOutputs : std::monostate { };
typedef std::variant<AllOutputs, OutputNames> _OutputsSpecRaw;
@@ -64,9 +62,7 @@ struct OutputsSpec : _OutputsSpecRaw {
std::string to_string() const;
};
-struct DefaultOutputs {
- bool operator < (const DefaultOutputs & _) const { return false; }
-};
+struct DefaultOutputs : std::monostate { };
typedef std::variant<DefaultOutputs, OutputsSpec> _ExtendedOutputsSpecRaw;
@@ -84,6 +80,7 @@ struct ExtendedOutputsSpec : _ExtendedOutputsSpecRaw {
/* Parse a string of the form 'prefix^output1,...outputN' or
'prefix^*', returning the prefix and the extended outputs spec. */
static std::pair<std::string_view, ExtendedOutputsSpec> parse(std::string_view s);
+ static std::optional<std::pair<std::string_view, ExtendedOutputsSpec>> parseOpt(std::string_view s);
std::string to_string() const;
};