package eio

  1. Overview
  2. Docs
Effect-based direct-style IO API for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

eio-1.6.tbz
sha256=c1f04986b401094176494863dde1ca9b292b59fdc679a9d7023e558d80fb5b15
sha512=92ed8cf20300b8a4e0141bdbc373c0803c5a24530cb65852637d905fff4a5b956a8859a00a424034ff78c1112da9b0391194bcd558326168bdebd1ce683a8890

doc/src/eio.unix/file.ml.html

Source file file.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
open Eio.Std

type rw_ty = [`Unix_fd | Eio.File.rw_ty]
type ro_ty = [`Unix_fd | Eio.File.ro_ty]

let open_type s = (s : rw_ty r :> [< rw_ty] r)

let import_rw ~sw ~close_unix fd =
  let fd = Fd.of_unix ~sw ~close_unix fd in
  (* The backend may set [fd] to be non-blocking.
     This is OK, because [Fd] checks for it lazily and we haven't asked it yet. *)
  open_type @@ Effect.perform (Private.Import_file fd)

let import_ro = import_rw