package luv

  1. Overview
  2. Docs
On This Page
  1. Features
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.

This module itself is present since Luv 0.5.7.

type 'a feature constraint 'a = 'run_time * 'compile_time

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.

val get : ('run_time * _) feature -> 'run_time

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.

val has : (bool * {__true}405) feature -> unit

Triggers a compile-time check of a bool feature.

For example, take Luv.Require.(has random).

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 {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

See Luv.System_info.available_parallelism. Requires libuv 1.44.0.

val clock_gettime : (bool * {__true}405) feature

See Luv.Time.clock_gettime. Requires libuv 1.45.0.

val cpumask_size : (bool * {__true}405) feature

See Luv.System_info.cpumask_size. Requires libuv 1.45.0.

val disconnect : (bool * {__true}405) feature

See `DISCONNECT in Luv.Poll.Event.t. Requires libuv 1.9.0.

val eftype : (bool * {__true}405) feature

See `EFTYPE in Luv.Error.t. Requires libuv 1.21.0.

val eilseq : (bool * {__true}405) feature

See `EILSEQ in Luv.Error.t. Requires libuv 1.32.0.

val enodata : (bool * {__true}405) feature

See `ENODATA in Luv.Error.t. Requires libuv 1.45.0.

val enotty : (bool * {__true}405) feature

See `ENOTTY in Luv.Error.t. Requires libuv 1.16.0.

val eoverflow : (bool * {__true}405) feature

See `EOVERFLOW in Luv.Error.t. Requires libuv 1.42.0.

val err_name_r : (bool * {__true}405) feature

See Luv.Error.err_name. Requires libuv 1.22.0.

val esocktnosupport : (bool * {__true}405) feature

See `ESOCKTNOSUPPORT in Luv.Error.t. Requires libuv 1.42.0.

val eunatch : (bool * {__true}405) feature

See `EUNATCH in Luv.Error.t. Requires libuv 1.46.0.

val fs_copyfile : (bool * {__true}405) feature

See Luv.File.copyfile. Requires libuv 1.14.0.

val fs_copyfile_ficlone : (bool * {__true}405) feature

See signature of Luv.File.copyfile. Requires libuv 1.20.0.

val fs_lutime : (bool * {__true}405) feature

See Luv.File.lutime. Requires libuv 1.36.0.

val fs_lchown : (bool * {__true}405) feature

See Luv.File.lchown. Requires libuv 1.21.0.

val fs_mkstemp : (bool * {__true}405) feature

See Luv.File.mkstemp. Requires libuv 1.34.0.

val fs_o_filemap : (bool * {__true}405) feature

See `FILEMAP Luv.File.Open_flag.t. Requires libuv 1.31.0.

val fs_realpath : (bool * {__true}405) feature

See Luv.File.realpath. Requires libuv 1.8.0.

val fs_statfs : (bool * {__true}405) feature

See Luv.File.statfs. Requires libuv 1.31.0.

val get_available_memory : (bool * {__true}405) feature

See Luv.Resource.available_memory. Requires libuv 1.45.0.

val get_constrained_memory : (bool * {__true}405) feature

See Luv.Resource.constrained_memory. Requires libuv 1.29.0.

val get_osfhandle : (bool * {__true}405) feature

See Luv.File.get_osfhandle. Requires libuv 1.12.0.

val getaffinity : (bool * {__true}405) feature

See Luv.Thread.getaffinity Requires libuv 1.45.0.

val getcpu : (bool * {__true}405) feature

See Luv.Thread.getcpu. Requires libuv 1.45.0.

val getpriority : (bool * {__true}405) feature

See Luv.Thread.getpriority. Requires libuv 1.48.0.

val gettimeofday : (bool * {__true}405) feature

See Luv.Time.gettimeofday. Requires libuv 1.28.0.

val if_indextoiid : (bool * {__true}405) feature

See Luv.Network.if_indextoiid. Requires libuv 1.16.0.

val if_indextoname : (bool * {__true}405) feature

See Luv.Network.if_indextoname. Requires libuv 1.16.0.

val library_shutdown : (bool * {__true}405) feature

See Luv.Loop.library_shutdown. Requires libuv 1.38.0.

val loop_fork : (bool * {__true}405) feature

See Luv.Loop.fork. Requires libuv 1.12.0.

val maxhostnamesize : (bool * {__true}405) feature

Used internally. Requires libuv 1.26.0.

val metrics_idle_time : (bool * {__true}405) feature

See Luv.Metrics.idle_time. Requires libuv 1.39.0.

val metrics_info : (bool * {__true}405) feature

See Luv.Metrics.info. Requires libuv 1.45.0.

val mutex_init_recursive : (bool * {__true}405) feature

See Luv.Mutex.init. Requires libuv 1.15.0.

val open_osfhandle : (bool * {__true}405) feature

See Luv.File.open_osfhandle. Requires libuv 1.23.0.

val os_environ : (bool * {__true}405) feature

See Luv.Env.environ. Requires libuv 1.31.0.

val os_homedir : (bool * {__true}405) feature

See Luv.Path.homedir. Requires libuv 1.6.0.

val os_get_group : (bool * {__true}405) feature

See Luv.Passwd.get_group. Requires libuv 1.45.0.

val os_get_passwd : (bool * {__true}405) feature

See Luv.Passwd.get_passwd. Requires libuv 1.9.0.

val os_get_passwd_uid : (bool * {__true}405) feature

See Luv.Passwd.get_passwd. Requires libuv 1.45.0.

val os_getenv : (bool * {__true}405) feature

See Luv.Env.getenv. Requires libuv 1.12.0.

val os_gethostname : (bool * {__true}405) feature

See Luv.Network.gethostname. Requires libuv 1.12.0.

val os_getpid : (bool * {__true}405) feature

See Luv.Pid.getpid. Requires libuv 1.18.0.

val os_getppid : (bool * {__true}405) feature

See Luv.Pid.getppid. Requires libuv 1.16.0.

val os_priority : (bool * {__true}405) feature

See Luv.Resource.setpriority. Requires libuv 1.23.0.

val os_tmpdir : (bool * {__true}405) feature

See Luv.Path.tmpdir. Requires libuv 1.9.0.

val os_uname : (bool * {__true}405) feature

See Luv.System_info.uname. Requires libuv 1.25.0.

val overlapped_pipe : (bool * {__true}405) feature

See Luv.Process.to_parent_pipe. Requires libuv 1.21.0.

val pipe : (bool * {__true}405) feature

See Luv.Pipe.pipe Requires libuv 1.41.0.

val pipe_bind2 : (bool * {__true}405) feature

See Luv.Pipe.bind. Requires libuv 1.46.0.

val pipe_connect2 : (bool * {__true}405) feature

See Luv.Pipe.connect. Requires libuv 1.46.0.

val pipe_chmod : (bool * {__true}405) feature

See Luv.Pipe.chmod. Requires libuv 1.16.0.

val prioritized : (bool * {__true}405) feature

See `PRIORITIZED in Luv.Poll.Event.t. Requires libuv 1.14.0.

val process_windows_hide_console : (bool * {__true}405) feature

See Luv.Process.spawn. Requires libuv 1.24.0.

val process_windows_hide_gui : (bool * {__true}405) feature

See Luv.Process.spawn. Requires libuv 1.24.0.

val process_windows_file_path_exact_name : (bool * {__true}405) feature

See Luv.Process.spawn. Requires libuv 1.48.0.

val random : (bool * {__true}405) feature

See Luv.Random.random. Requires libuv 1.33.0.

val readdir : (bool * {__true}405) feature

See Luv.File.readdir. Requires libuv 1.28.0.

val setaffinity : (bool * {__true}405) feature

See Luv.Thread.setaffinity. Requires libuv 1.45.0.

val setpriority : (bool * {__true}405) feature

See Luv.Thread.setpriority. Requires libuv 1.48.0.

val signal_start_oneshot : (bool * {__true}405) feature

See Luv.Signal.start_oneshot. Requires libuv 1.12.0.

val sleep : (bool * {__true}405) feature

See Luv.Time.sleep. Requires libuv 1.34.0.

val socketpair : (bool * {__true}405) feature

See Luv.TCP.socketpair. Requires libuv 1.41.0.

val strerror_r : (bool * {__true}405) feature

See Luv.Error.strerror. Requires libuv 1.22.0.

val tcp_close_reset : (bool * {__true}405) feature

See Luv.TCP.close_reset. Requires libuv 1.32.0.

val tcp_init_ex : (bool * {__true}405) feature

See Luv.TCP.init. Requires libuv 1.7.0.

val timer_get_due_in : (bool * {__true}405) feature

See Luv.Timer.get_due_in. Requires libuv 1.40.0.

val thread_stack_size : (bool * {__true}405) feature

See Luv.Thread.create. Requires libuv 1.26.0.

val translate_sys_error : (bool * {__true}405) feature

See Luv.Error.translate_sys_error. Requires libuv 1.10.0.

val try_write2 : (bool * {__true}405) feature

See Luv.Stream.try_write2. Requires libuv 1.42.0.

val tty_vterm_state : (bool * {__true}405) feature

See Luv.TTY.set_vterm_state. Requires libuv 1.33.0.

val udp_connect : (bool * {__true}405) feature

See Luv.UDP.Connected. Requires libuv 1.27.0.

val udp_init_ex : (bool * {__true}405) feature

See Luv.UDP.init. Requires libuv 1.7.0.

val udp_mmsg_chunk : (bool * {__true}405) feature

See `MMSG_CHUNK in Luv.UDP.Recv_flag.t. Requires libuv 1.35.0.

val udp_mmsg_free : (bool * {__true}405) feature

See `MMSG_FREE in Luv.UDP.Recv_flag.t. Requires libuv 1.40.0.

val udp_recvmmsg : (bool * {__true}405) feature

See Luv.UDP.init. Requires libuv 1.37.0.

val udp_set_source_membership : (bool * {__true}405) feature

See Luv.UDP.set_source_membership. Requires libuv 1.32.0.

val udp_using_recvmmsg : (bool * {__true}405) feature

See Luv.UDP.using_recvmmsg. Requires libuv 1.39.0.

val utf_16 : (bool * {__true}405) feature

See Luv.String. Requires libuv 1.47.0.

OCaml

Innovation. Community. Security.