aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--perl/meson.build1
-rw-r--r--src/libutil/serialise.hh9
2 files changed, 10 insertions, 0 deletions
diff --git a/perl/meson.build b/perl/meson.build
index b542f3e8a..6f078f8e6 100644
--- a/perl/meson.build
+++ b/perl/meson.build
@@ -65,5 +65,6 @@ if cxx.get_linker_id() in ['ld.bfd', 'ld.gold']
endif
libstore = dependency('lixstore', 'lix-store', required : true)
+libutil = dependency('lixutil', 'lix-util', required : true)
subdir('lib/Nix')
diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh
index 0632e3109..491b1987d 100644
--- a/src/libutil/serialise.hh
+++ b/src/libutil/serialise.hh
@@ -1,8 +1,10 @@
#pragma once
///@file
+#include <concepts>
#include <memory>
+#include "generator.hh"
#include "strings.hh"
#include "types.hh"
#include "file-descriptor.hh"
@@ -340,6 +342,13 @@ std::unique_ptr<FinishSink> sourceToSink(std::function<void(Source &)> fun);
*/
std::unique_ptr<Source> sinkToSource(std::function<void(Sink &)> fun);
+inline Sink & operator<<(Sink & sink, Generator<Bytes> && g)
+{
+ while (auto buffer = g.next()) {
+ sink(std::string_view(buffer->data(), buffer->size()));
+ }
+ return sink;
+}
void writePadding(size_t len, Sink & sink);
void writeString(std::string_view s, Sink & sink);