package bytesrw
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=388858b0db210a62a16f56655746fdfadbc64b22c2abb5ed5a12b2872e4f8c34f045cdb953a5dda9b92f0003c7f9f34d70fa5b5bb19fd32fb6121bbaeb7ceba0
doc/bytesrw/Bytesrw/Bytes/Stream/index.html
Module Bytes.StreamSource
Byte streams.
Byte streams are sequences of non-empty byte slices ended by a single Slice.eod slice. They have no concrete incarnation, they are observed by Bytes.Readers and Bytes.Writers.
See the quick start and read more about streams in the tutorial.
Positions
The type for stream positions.
The position of a stream is the zero-based byte index of the next byte to read or write. It can also be seen as the count of bytes read or written by a stream reader or writer.
Formats
The type for stream formats. An identifier for the format of read or written bytes. Favour mime types or lowercased file extensions without the dot.
Errors
Read more about errors in the tutorial.
The type for stream errors. Stream formats add their own cases to this type. See an example.
The type for error contexts.
The exception raised by streams reader, writers and their creation functions.
error_message e turns error e into an error message for humans.
error_to_result e is Result.Error (error_message e).
The type for describing errors of type 'e for a stream format.
val make_format_error :
format:format ->
case:('e -> error) ->
message:(error -> string) ->
'e format_errormake_format_error ~format ~case ~message describes the type of error for format format:
formatidentifies the streamformat.caseis the function that injects the type intoerror.messageis a function that must stringify the results ofcase.
See an example.
error fmt e errors with e for a stream fmt by raising an Error exception.
Limits
The type for stream limits errors.
limit_error is a stream limit error.