# 2.3 Byte Streams

typedef size_t (*SerdSink)(const void *buf, size_t len, void *stream)

  Sink function for raw string output.

typedef size_t (*SerdSource)(void *buf, size_t size, size_t nmemb, void *stream)

  Source function for raw string input.

  Identical semantics to `fread`, but may set errno for more informative error reporting than supported by `SerdStreamErrorFunc`.

  Param buf:

    Output buffer.

  Param size:

    Size of a single element of data in bytes (always 1).

  Param nmemb:

    Number of elements to read.

  Param stream:

    Stream to read from (FILE* for fread).

  Returns:

    Number of elements (bytes) read.

typedef int (*SerdStreamErrorFunc)(void *stream)

  Function to detect I/O stream errors.

  Identical semantics to `ferror`.

  Returns:

    Non-zero if `stream` has encountered an error.