aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/experimental-features.hh
diff options
context:
space:
mode:
authorYorick van Pelt <yorick@yorickvanpelt.nl>2022-04-20 15:41:01 +0200
committerYorick van Pelt <yorick@yorickvanpelt.nl>2022-04-20 15:41:01 +0200
commitebf2fd76b106d5eb8f45ccce0615653108bb99bc (patch)
tree9fa4f96b7ed64c750388571a6803d51c11a7a9eb /src/libutil/experimental-features.hh
parentcd0549a9cd91369f2ad858f0887c5e19077664a1 (diff)
Add custom to_json and from_json functions for ExperimentalFeature
nix show-config --json was serializing experimental features as ints. nlohmann::json will automatically use these definitions to serialize and deserialize ExperimentalFeatures. Strictly, we don't use the from_json instance yet, it's provided for completeness and hopefully future use.
Diffstat (limited to 'src/libutil/experimental-features.hh')
-rw-r--r--src/libutil/experimental-features.hh7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libutil/experimental-features.hh b/src/libutil/experimental-features.hh
index 266e41a22..a6d080094 100644
--- a/src/libutil/experimental-features.hh
+++ b/src/libutil/experimental-features.hh
@@ -51,4 +51,11 @@ public:
MissingExperimentalFeature(ExperimentalFeature);
};
+/**
+ * Semi-magic conversion to and from json.
+ * See the nlohmann/json readme for more details.
+ */
+void to_json(nlohmann::json&, const ExperimentalFeature&);
+void from_json(const nlohmann::json&, ExperimentalFeature&);
+
}