package core_unix

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t = unit t
include Ppx_compare_lib.Comparable.S with type t := t
val compare : t -> t -> int
val sexp_of_t : t -> Sexplib0.Sexp.t
include Core.Equal.S with type t := t
val equal : t Base.Equal.equal
val create_ok : unit -> t
val create_error : UnixLabels.error -> t
val is_ok : t -> bool
val is_error : t -> bool
val to_result : t -> (unit, UnixLabels.error) Core.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 -> unit
val error_exn : t -> UnixLabels.error
val reinterpret_error_exn : t -> _ t

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 -> unit
val ok_or_unix_error_with_args_exn : t -> syscall_name:string -> 'a -> ('a -> Core.Sexp.t) -> unit
module Optional_syntax : Core.Optional_syntax.S with type t := t and type value := unit