package eio

All checked builds pass
  1. Overview
  2. Docs
Effect-based direct-style IO API for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

eio-1.7.tbz
sha256=a9771c0d7f4d9d9fe17badd3d147c96e85f34410ab252119ade2a407ab41ccb5
sha512=a6e0bfdc7d48886b613ba70004a46309e4162f6109d9603fbe9d70dafcc4fad3cd2382998685b1db4bb8e5bf0bbc89371b9023644d3bfaa80757e5e6939c6d8e

doc/eio.mock/Eio_mock/Flow/index.html

Module Eio_mock.FlowSource

Mock Eio.Flow sources and sinks.

Sourcetype ty = [ `Generic | `Mock ] Eio.Net.stream_socket_ty
Sourceval make : ?pp:string Fmt.t -> string -> t

make label is a mock Eio flow. It can be used as a source, sink, or two-way flow.

  • parameter pp

    Printer to use to display the data.

Sourceval on_read : t -> string Handler.actions -> unit

on_read t actions configures the values to return from the mock's read function.

Sourceval on_copy_bytes : t -> int Handler.actions -> unit

on_copy_bytes t actions limits the number of bytes accepted by each write operation.

Sourceval trace_reads : string -> _ Eio.Flow.source -> Eio.Flow.source_ty Eio.Std.r

trace_reads label s wraps s to make a new source that traces reads (including via Read_source_buffer).

  • since 1.7
Sourceval limit_reads : int list -> _ Eio.Flow.source -> Eio.Flow.source_ty Eio.Std.r

limit_reads sizes s wraps s to make a new source that limits the buffers passed to single_read or to the Read_source_buffer callback to the given sizes. e.g. limit_reads [3; 2] s ensures that the first read will get no more than 3 bytes. Once sizes is exhausted, reads are unlimited.

  • since 1.7