Legend:
Library
Module
Module type
Parameter
Class
Class type
Feature checks.
You probably don't need these!
If you installed Luv in the usual way, through either opam or esy, you can ignore this module completely. In this case, Luv internally installed a vendored libuv of a recent version, and you have all the latest APIs available — whatever is exposed by your version of Luv is actually implemented by libuv.
However, if you installed Luv through a system package manager, or tweaked your Luv installation so that it links to a system or other external libuv — or if your users will do so — that external libuv might be of a considerably older version than Luv expects. Not all features normally exposed by Luv might actually be available.
For that case, this module provides a bunch of useful feature checks, so that you can control the behavior of your downstream project and/or prevent its compilation with too old a libuv.
A value of type 'a feature is physically either a bool or an int.
The constraint notation can be ignored. It's part of this module's internal type machinery for implementing compile-time feature checking.
Specific features (see below) have types like _40 feature or _true
feature. The first is an int feature whose run-time value is 40, and the second is a bool feature whose run-time value is true.
As you can see, the run-time value can be seen from the type, and therefore from the docs, at a glance. So, you can quickly find out what your libuv supports by generating the docs for your Luv installation and looking at this module.
Of course, if you installed Luv through opam/esy and are using its vendored libuv, the int features will simply be the corresponding libuv version, and all the bool features will be _true.
Returns the value of a feature at run time — in the ordinary way. Examples:
Luv.Require.(get luv05) returns 7 at the time of this writing — the current patch version of Luv (0.5.7).
Luv.Require.(get random) returns true if Luv was linked with a libuv late enough that it supports uv_random (1.33.0 or higher).
val (>=) : (int * 'compile_time)feature->'compile_time{number}304-> unit
Triggers a compile-time check of an int feature.
For example, take Luv.Require.(libuv1 >= _33).
If the linked libuv has version 1.33.0 or higher, this check compiles. The compiled check then does nothing at run time — it is zero-cost.
If libuv has version less than 1.33.0, compilation of this expression triggers a type error. If that is too severe, you can relax to a run-time check by doing Luv.Require.(get libuv1) >= 33 instead.
The compile-time numbers _0 — _99 are defined for use with Luv.Require.(>=). They are hidden from this documentation to reduce visual noise.
These compile-time checks are modular in the sense that you can spread them throughout your project, locally where various features of libuv are being used, so that you don't have to do a survey of all your code in order to figure out the overall minimum libuv version. During build, your project will compile only if all the checks in its modules pass. They will then be optimized away.
If the linked libuv has uv_random, this check compiles, and is fully optimized away.
If libuv lacks uv_random, compilation of this check triggers a type error. The check can be relaxed to run time by doing Luv.Require.(get random) instead.
As with Luv.Require.(>=), you can insert these checks throughout your program, locally near where you use libuv features. The project will compile only if all the checks pass.
Features
val libuv1 :
(int
* {___0}2{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1{s}1)feature
libuv minor version in the 1.x series.
val luv05 : (int * {___0}2{s}1{s}1{s}1{s}1{s}1{s}1{s}1)feature
Luv patch version in the 0.5.x series.
val available_parallelism : (bool * {__true}405)feature