package eio_luv

  1. Overview
  2. Docs
type 'a or_error = ('a, Luv.Error.t) Stdlib.result
val get_loop : unit -> Luv.Loop.t

get_loop () returns the current fiber's event loop.

When using the Luv API directly, you must pass this to any Luv function that accepts a loop as an optional argument in order to use the resource with Eio. The wrapper functions in this file all do this for you.

val or_raise : 'a or_error -> 'a

or_raise (Error e) raises Eio.Exn.Io with e.

val await_with_cancel : request: [< `File | `Addr_info | `Name_info | `Random | `Thread_pool ] Luv.Request.t -> (Luv.Loop.t -> ('a -> unit) -> unit) -> 'a

await_with_cancel ~request fn converts a function using a luv-style callback to one using effects. It sets the fiber's cancel function to cancel request, and clears it when the operation completes.

Time functions

val sleep_until : float -> unit

sleep_until time blocks until the current time is time.

DNS functions

val getaddrinfo : service:string -> string -> Eio.Net.Sockaddr.t list

getaddrinfo ~service host returns a list of IP addresses for host. host is either a domain name or an ipaddress.

Low-level wrappers for Luv functions

module File : sig ... end
module Random : sig ... end
module Handle : sig ... end
module Stream : sig ... end
module Pipe : sig ... end
module Process : sig ... end