1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 04:21:16 +02:00

Use TeeSink and TeeSouce in a few more places

This commit is contained in:
John Ericson 2020-08-13 14:47:53 +00:00
parent 859cd4acea
commit 85aacbee64
5 changed files with 20 additions and 21 deletions

View file

@ -225,6 +225,17 @@ struct SizedSource : Source
}
};
/* A sink that that just counts the number of bytes given to it */
struct LengthSink : Sink
{
uint64_t length = 0;
virtual void operator () (const unsigned char * _, size_t len)
{
length += len;
}
};
/* Convert a function into a sink. */
struct LambdaSink : Sink
{