Legend:
Library
Module
Module type
Parameter
Class
Class type
Capabilities for arrays.
This modules provides the same set of features as Array, but with the added twist that arrays can be made read-only or write-only. Read-only arrays may then be safely shared and distributed.
There is no loss of performance involved.
Only the capability-specific functions are documented here. See the complete Array module for the documentation of other functions.
type('a, 'b) tconstraint'b = [< `Read | `Write ]
The type of arrays with capabilities. An ('a, [`Read | `Write]) array behaves as a regular 'a array, while a ('a, [`Read]) array only has read-only capabilities and a ('a, [`Write]) array only has write-only capabilities.
Adopt a regular array as a capability array, allowing to decrease capabilities if necessary.
This operation involves no copying. In other words, in let cap = of_array a in ..., any modification in a will also have effect on cap and reciprocally.
val to_array : ('a, [ `Read | `Write ])t->'a array
Return a capability array as an array.
This operation requires both read and write permissions on the capability array and involves no copying. In other words, in let a = of_array cap in ..., any modification in a will also have effect on cap and reciprocally.
val read_only : ('a, [> `Read ])t->('a, [ `Read ])t
Drop to read-only permissions.
This operation involves no copying.
val write_only : ('a, [> `Write ])t->('a, [ `Write ])t