package core

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A 'a Set_once.t is like an 'a option ref that can only be set once. A Set_once.t starts out as None, the first set transitions it to Some, and subsequent sets fail.

type 'a t
val sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t

Passes when unset.

val invariant : 'a Base__.Invariant_intf.inv -> 'a t Base__.Invariant_intf.inv
val create : Base.Unit.t -> _ t
val set : 'a t -> Source_code_position.t -> 'a -> Base.Unit.t Or_error.t
val set_exn : 'a t -> Source_code_position.t -> 'a -> Base.Unit.t
val set_if_none : 'a t -> Source_code_position.t -> 'a -> Base.Unit.t

set_if_none t here a will do nothing if is_some t, otherwise it will set_exn t here a.

val get : 'a t -> 'a Base.Option.t
val get_exn : 'a t -> Source_code_position.t -> 'a
val is_none : _ t -> Base.Bool.t
val is_some : _ t -> Base.Bool.t
val iter : 'a t -> f:('a -> Base.Unit.t) -> Base.Unit.t
module Optional_syntax : Optional_syntax.S1 with type 'a t := 'a t with type 'a value := 'a
module Unstable : sig ... end
module Stable : sig ... end
OCaml

Innovation. Community. Security.