Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::Source Struct Referenceabstract

#include <serialise.hh>

Inheritance diagram for nix::Source:
nix::ArchiveDecompressionSource nix::BrotliDecompressionSource nix::BufferedSource nix::FramedSource nix::GeneratorSource nix::IndirectAsyncInputStreamToSource nix::LambdaSource nix::RewritingSource nix::SizedSource nix::StreamToSourceAdapter nix::StringSource nix::TeeSource nix::curlFileTransfer::TransferSource

Public Member Functions

void operator() (char *data, size_t len)
virtual size_t read (char *data, size_t len)=0
virtual bool good ()
void drainInto (Sink &sink)
std::string drain ()

Detailed Description

Abstract source of binary data.

Member Function Documentation

◆ operator()()

void nix::Source::operator() ( char * data,
size_t len )

Store exactly ‘len’ bytes in the buffer pointed to by ‘data’. It blocks until all the requested data is available, or throws an error if it is not going to be available.

◆ read()

virtual size_t nix::Source::read ( char * data,
size_t len )
pure virtual

Store up to ‘len’ in the buffer pointed to by ‘data’, and return the number of bytes stored. It blocks until at least one byte is available.

Should not return 0 (generally you want to throw EndOfFile), but nothing stops that.

Exceptions
EndOfFileif there is no more data.

Implemented in nix::ArchiveDecompressionSource, nix::BrotliDecompressionSource, nix::BufferedSource, nix::curlFileTransfer::TransferSource, nix::FramedSource, nix::GeneratorSource, nix::IndirectAsyncInputStreamToSource, nix::LambdaSource, nix::RewritingSource, nix::SizedSource, nix::StreamToSourceAdapter, nix::StringSource, and nix::TeeSource.


The documentation for this struct was generated from the following files: