aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-06-27 16:30:45 +0200
committereldritch horrors <pennae@lix.systems>2024-07-03 11:46:53 +0000
commit4857feb9101ca4479f922040be17f27ee1486455 (patch)
treeb17bf21ba8286800b0eb31f58672f3c2592e0027 /src/libutil
parent73ddc4540f5f85ef9e01be4e2e362c6c88e47fa3 (diff)
libutil: add Bytes type
not used anywhere yet, but we'll use this a lot soon for generators that return file contents, wire protocol fragments, or indeed any byte stream Change-Id: I01a46f9bf9d75aaf4a5d7662773b99f498862a28
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/types.hh5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libutil/types.hh b/src/libutil/types.hh
index 4974634d8..13cb062fb 100644
--- a/src/libutil/types.hh
+++ b/src/libutil/types.hh
@@ -11,6 +11,7 @@
#include <map>
#include <variant>
#include <vector>
+#include <span>
namespace nix {
@@ -19,6 +20,10 @@ typedef std::set<std::string> StringSet;
typedef std::map<std::string, std::string> StringMap;
typedef std::map<std::string, std::string> StringPairs;
+// TODO this should be a std::byte span, but too much of the
+// current codebase predates std::byte and uses char instead
+using Bytes = std::span<const char>;
+
/**
* Paths are just strings.
*/