1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-30 03:23:16 +02:00

Improve 'coroutine has finished' error message

This commit is contained in:
Eelco Dolstra 2018-08-21 15:22:04 +02:00
parent 6317c65937
commit ebe3d2d370
3 changed files with 16 additions and 7 deletions

View file

@ -214,7 +214,11 @@ struct LambdaSource : Source
/* Convert a function that feeds data into a Sink into a Source. The
Source executes the function as a coroutine. */
std::unique_ptr<Source> sinkToSource(std::function<void(Sink &)> fun);
std::unique_ptr<Source> sinkToSource(
std::function<void(Sink &)> fun,
std::function<void()> eof = []() {
throw EndOfFile("coroutine has finished");
});
void writePadding(size_t len, Sink & sink);