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

#include <serialise.hh>

Inheritance diagram for nix::LambdaSource:
[legend]
Collaboration diagram for nix::LambdaSource:
[legend]

Public Types

typedef std::function< size_t(char *, size_t) lambda_t)
 

Public Member Functions

 LambdaSource (const lambda_t &lambda)
 
size_t read (char *data, size_t len) override
 
- 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

lambda_t lambda
 

Detailed Description

Convert a function into a source.

Member Function Documentation

◆ read()

size_t nix::LambdaSource::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: