Module Core__.Syscall_result.Make

Parameters

M : Arg

Signature

type ok_value
type 'a syscall_result
type t = ok_value syscall_result
include sig ... end
val compare : t ‑> t ‑> int
val sexp_of_t : t ‑> Sexplib.Sexp.t
include Core__.Import.Equal.S with type t := t
type t
val create_ok : ok_value ‑> t
val create_error : Core__.Unix_error.t ‑> t
val is_ok : t ‑> bool
val is_error : t ‑> bool
val to_result : t ‑> (ok_valueCore__.Unix_error.tCore__.Import.Result.t

This returns a preallocated object for all errors and at least a few ok_values, so can be used in many contexts where avoiding allocation is important.

val ok_exn : t ‑> ok_value
val error_exn : t ‑> Core__.Unix_error.t
val reinterpret_error_exn : t ‑> _ syscall_result

This is more efficient than calling error_exn and then the create_error of the destination type.

val ok_or_unix_error_exn : t ‑> syscall_name:string ‑> ok_value
val ok_or_unix_error_with_args_exn : t ‑> syscall_name:string ‑> 'a ‑> ('a ‑> Core__.Import.Sexp.t) ‑> ok_value
module Optional_syntax : Core__.Import.Optional_syntax.S with type t := t and type value := ok_value