jon.recoil.org

Module Data.Or_nullSource

Sourcetype (('a : value_or_null), 'k) t : (value_or_null mod everything) with 'a @@ contended portable
Sourceval wrap : ('a : value_or_null) 'k. access:'k Capsule_prim__.Prim.Access.t -> 'a -> ('a, 'k) t @@ portable

wrap ~access v returns a pointer to the value v, which lives in the capsule 'k. 'k is always the current capsule.

Sourceval unwrap : ('a : value_or_null) 'k. access:'k Capsule_prim__.Prim.Access.t -> ('a, 'k) t -> 'a @@ portable

unwrap ~access t returns the value of t, which lives in the capsule 'k. 'k is always the current capsule.

Sourceval create : ('a : value_or_null) 'k. (unit -> 'a) @ local once portable -> ('a, 'k) t @@ portable

create f runs f within the capsule 'k and returns a pointer to the result of f.

Sourceval project : ('a : value_or_null mod portable) 'k. ('a, 'k) t -> 'a @ contended @@ portable

project t returns the value of t. The result is within 'k, so is marked contended. The value is required to always be portable, so unlike extract, project does not require permission to access 'k. This is safe because all accesses to the value happen only after it's marked contended.