Module Core_kernel.Set_once

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 -> Ppx_sexp_conv_lib.Sexp.t) -> 'a t -> Ppx_sexp_conv_lib.Sexp.t

Passes when unset.

include Core_kernel__.Import.Invariant.S1 with type 'a t := 'a t
type 'a t
val invariant : 'a Base__.Invariant_intf.inv -> 'a t Base__.Invariant_intf.inv
val create : Core_kernel__.Import.unit -> _ t
val set : 'a t -> Source_code_position.t -> 'a -> Core_kernel__.Import.unit Or_error.t
val set_exn : 'a t -> Source_code_position.t -> 'a -> Core_kernel__.Import.unit
val set_if_none : 'a t -> Source_code_position.t -> 'a -> Core_kernel__.Import.unit

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 Core_kernel__.Import.option
val get_exn : 'a t -> Source_code_position.t -> 'a
val is_none : _ t -> Core_kernel__.Import.bool
val is_some : _ t -> Core_kernel__.Import.bool
val iter : 'a t -> f:('a -> Core_kernel__.Import.unit) -> Core_kernel__.Import.unit
module Optional_syntax : Optional_syntax.S1 with type 'a t := 'a t with type 'a value := 'a Core_kernel__.Import.identity
module Unstable : sig ... end
module Stable : sig ... end