Module type Immediate_option.S_plain
include Immediate_option_intf.S_without_immediate_plain with type t := t
type valueThe immediate value carried by the immediate option.
Given the presence of
unchecked_value, thevaluetype should not have operations that depend on the value's validity for memory safety. In particular,unchecked_valueis not calledunsafe_valueas it would be if it could return a value that later resulted in a segmentation fault. For pointer-like values, useExt.Nullable, for example.
type tRepresents
value optionwithout allocating aSometag. The interface does not enforce thattis immediate because some types, likeInt63.t, are only immediate on 64-bit platforms. For representations whose type is immediate, useSbelow which adds the[@@immediate]annotation.
val none : tval some : value -> tval some_is_representable : value -> Core_kernel__.Import.boolFor some representations of immediate options, the encodings of
noneandsomeoverlap. For these representations,some_is_representable value = falseifvaluecannot be represented as an option. For example,Int.Optionusesmin_valueto representnone. For other representations,some_is_representablealways returnstrue.
val is_none : t -> Core_kernel__.Import.boolval is_some : t -> Core_kernel__.Import.boolval value : t -> default:value -> valuevalue (some x) ~default = xandvalue none ~default = default.
val value_exn : t -> valuevalue_exn (some x) = x.value_exn noneraises. UnlikeOption.value_exn, there is no?messageargument, so that calls tovalue_exnthat do not raise also do not have to allocate.
val unchecked_value : t -> valueunchecked_value (some x) = x.unchecked_value nonereturns an unspecified value.unchecked_value tis intended as an optimization ofvalue_exn twhenis_some tis known to be true.
val to_option : t -> value Core_kernel__.Import.optionval of_option : value Core_kernel__.Import.option -> t
module Optional_syntax : Optional_syntax.S with type t := t with type value := value