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

#include <serialise.hh>

Inheritance diagram for nix::SizedSource:
nix::Source

Public Member Functions

 SizedSource (Source &orig, size_t size)
size_t read (char *data, size_t len) override
size_t drainAll ()
Public Member Functions inherited from nix::Source
void operator() (char *data, size_t len)
virtual bool good ()
void drainInto (Sink &sink)
std::string drain ()

Public Attributes

Sourceorig
size_t remain

Detailed Description

A reader that consumes the original Source until 'size'.

Member Function Documentation

◆ drainAll()

size_t nix::SizedSource::drainAll ( )
inline

Consume the original source until no remain data is left to consume.

◆ read()

size_t nix::SizedSource::read ( char * data,
size_t len )
inlineoverridevirtual

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.

Implements nix::Source.


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