Module Eio_test_providers.Eio_reader

Eio_reader is a provider for the Test_interfaces.Directory_reader and Test_interfaces.File_reader interfaces, based on Eio.

It is a thin wrapper around Eio.Path, meant to demonstrate how to implement a provider for a given interface.

Test_providers.Unix_reader is another provider for the Test_interfaces.Directory_reader interface.

type t

Depending on the needs, the type t may be exposed or not. It can be anything required by the implementation.

Somehow there must be a way exposed to construct a provider, decorated with the tags that the provider implements. Here, the construct [ `Directory_reader | `File_reader ] means that this provider implements both interfaces: Test_interfaces.Directory_reader and Test_interfaces.File_reader.

module Impl : sig ... end

In this specific example, we chose to expose the signature of the provider's implementation. This is not something that is usually required, since make already provides a way to build a provider. This is only done here for the sake of the tests, as we show different ways an interface can be built based on various parts of its implementation.