aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/meson.build1
-rw-r--r--src/libutil/result.hh24
2 files changed, 25 insertions, 0 deletions
diff --git a/src/libutil/meson.build b/src/libutil/meson.build
index 1ac31c7eb..a3f21de59 100644
--- a/src/libutil/meson.build
+++ b/src/libutil/meson.build
@@ -105,6 +105,7 @@ libutil_headers = files(
'regex-combinators.hh',
'regex.hh',
'repair-flag.hh',
+ 'result.hh',
'serialise.hh',
'shlex.hh',
'signals.hh',
diff --git a/src/libutil/result.hh b/src/libutil/result.hh
new file mode 100644
index 000000000..b01766fe4
--- /dev/null
+++ b/src/libutil/result.hh
@@ -0,0 +1,24 @@
+#pragma once
+/// @file
+
+#include <boost/outcome/std_outcome.hpp>
+#include <boost/outcome/std_result.hpp>
+#include <boost/outcome/success_failure.hpp>
+#include <exception>
+
+namespace nix {
+
+template<typename T, typename E = std::exception_ptr>
+using Result = boost::outcome_v2::std_result<T, E>;
+
+template<typename T, typename D, typename E = std::exception_ptr>
+using Outcome = boost::outcome_v2::std_outcome<T, D, E>;
+
+namespace result {
+
+using boost::outcome_v2::success;
+using boost::outcome_v2::failure;
+
+}
+
+}