Module Data.Or_nullSource
Source
val wrap :
('a : value_or_null) 'k. access:'k Capsule_expert.Access.t ->
'a ->
('a, 'k) Capsule_expert.Data.Or_null.t @@ portablewrap ~access v returns a pointer to the value v, which lives in the capsule 'k. 'k is always the current capsule.
Source
val unwrap :
('a : value_or_null) 'k. access:'k Capsule_expert.Access.t ->
('a, 'k) Capsule_expert.Data.Or_null.t ->
'a @@ portableunwrap ~access t returns the value of t, which lives in the capsule 'k. 'k is always the current capsule.
Source
val create :
('a : value_or_null) 'k. (unit -> 'a) @ local local portable ->
('a, 'k) Capsule_expert.Data.Or_null.t @@ portablecreate f runs f within the capsule 'k and returns a pointer to the result of f.
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.