From 5eec6418de35daaa7b14b5412e39d85ce80a37cb Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Tue, 19 Mar 2024 22:22:18 +0100 Subject: libutil: begin porting serialization to generators generators are a better basis for serializers than streaming into sinks as we do currently for many reasons, such as being usable as sources if one wishes to (without requiring an intermediate sink to serialize full data sets into memory, or boost coroutines to turn sinks into sources), composing more naturally (as one can just yield a sub-generator instead of being forced to wrap entire substreams into clunky functions or even more clunky custom types to implement operator<< on), allowing wrappers to transform data with clear ownership semantics (removing the need for explicit memory allocations and Source wrappers), and many other things Change-Id: I361d89ff556354f6930d9204f55117565f2f7f20 --- src/libstore/remote-store.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstore/remote-store.cc') diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index b2f8a285d..55a71f502 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -897,7 +897,7 @@ std::exception_ptr RemoteStore::Connection::processStderr(Sink * sink, Source * if (!source) throw Error("no source"); size_t len = readNum(from); auto buf = std::make_unique(len); - writeString({(const char *) buf.get(), source->read(buf.get(), len)}, to); + to << std::string_view((const char *) buf.get(), source->read(buf.get(), len)); to.flush(); } -- cgit v1.2.3