Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
serialise.hh File Reference
#include <memory>
#include <type_traits>
#include "types.hh"
#include "util.hh"
#include "file-descriptor.hh"

Go to the source code of this file.

Classes

struct  nix::Sink
 
struct  nix::NullSink
 
struct  nix::FinishSink
 
struct  nix::BufferedSink
 
struct  nix::Source
 
struct  nix::BufferedSource
 
struct  nix::FdSink
 
struct  nix::FdSource
 
struct  nix::StringSink
 
struct  nix::StringSource
 
struct  nix::TeeSink
 
struct  nix::TeeSource
 
struct  nix::SizedSource
 
struct  nix::LengthSink
 
struct  nix::LengthSource
 
struct  nix::LambdaSink
 
struct  nix::LambdaSource
 
struct  nix::ChainSource
 
struct  nix::StreamToSourceAdapter
 
struct  nix::FramedSource
 
struct  nix::FramedSink
 

Functions

std::unique_ptr< FinishSinknix::sourceToSink (std::function< void(Source &)> fun)
 
std::unique_ptr< Sourcenix::sinkToSource (std::function< void(Sink &)> fun, std::function< void()> eof)
 
void nix::writePadding (size_t len, Sink &sink)
 
void nix::writeString (std::string_view data, Sink &sink)
 
Sinknix::operator<< (Sink &sink, uint64_t n)
 
Sinknix::operator<< (Sink &sink, const Error &ex)
 
Sinknix::operator<< (Sink &sink, std::string_view s)
 
Sinknix::operator<< (Sink &sink, const Strings &s)
 
Sinknix::operator<< (Sink &sink, const StringSet &s)
 
 nix::MakeError (SerialisationError, Error)
 
template<typename T>
nix::readNum (Source &source)
 
unsigned int nix::readInt (Source &source)
 
uint64_t nix::readLongLong (Source &source)
 
void nix::readPadding (size_t len, Source &source)
 
size_t nix::readString (char *buf, size_t max, Source &source)
 
std::string nix::readString (Source &source, size_t max)
 
template<class T>
nix::readStrings (Source &source)
 
Sourcenix::operator>> (Source &in, std::string &s)
 
template<typename T>
Sourcenix::operator>> (Source &in, T &n)
 
template<typename T>
Sourcenix::operator>> (Source &in, bool &b)
 
Error nix::readError (Source &source)
 

Function Documentation

◆ sinkToSource()

std::unique_ptr< Source > nix::sinkToSource ( std::function< void(Sink &)> fun,
std::function< void()> eof = []() { throw EndOfFile("coroutine has finished");} )

Convert a function that feeds data into a Sink into a Source. The Source executes the function as a coroutine.