Module UoptSource

Uopt.t is an unboxed option: an option-like type that incurs no allocation, without requiring a reserved value in the underlying type.

The downsides compared to option are that:

As a result, we advise against using this in systems that are not high performance.

When using Uopt, we recommend:

Since 'a Uopt.t is abstract, manipulation of an 'a Uopt.t array does runtime checks to see if this is a float array. This can be mostly avoided with Uniform_array.t, although array creation will still do such checks, and you may want to use the set_with_caml_modify kind of function to skip the immediacy checks.

Sourcetype +'a t
Sourceval sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
include Base.Invariant.S1 with type 'a t := 'a t
Sourceval invariant : ('a -> unit) -> 'a t -> unit
Sourceval none : _ t
Sourceval some : 'a -> 'a t
Sourceval some_local : 'a -> 'a t
Sourceval is_none : _ t -> Base.bool
Sourceval is_some : _ t -> Base.bool
Sourceval value_exn : 'a t -> 'a
Sourceval unsafe_value : 'a t -> 'a

It is safe to call unsafe_value t iff is_some t.

Sourceval to_option : 'a t -> 'a Base.option
Sourceval of_option : 'a Base.option -> 'a t
Sourcemodule Optional_syntax : sig ... end
Sourcemodule Local : sig ... end