moonpool/dev/ocaml/Stdlib/Ephemeron/K1/index.html

2 lines
No EOL
15 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>K1 (ocaml.Stdlib.Ephemeron.K1)</title><link rel="stylesheet" href="../../../../_odoc-theme/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../../../index.html">ocaml</a> &#x00BB; <a href="../../index.html">Stdlib</a> &#x00BB; <a href="../index.html">Ephemeron</a> &#x00BB; K1</nav><header class="odoc-preamble"><h1>Module <code><span>Ephemeron.K1</span></code></h1><p>Ephemerons with one key.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> <span>('k, 'd) t</span></span></code></div><div class="spec-doc"><p>an ephemeron with one key</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-create"><a href="#val-create" class="anchor"></a><code><span><span class="keyword">val</span> create : <span>unit <span class="arrow">&#45;&gt;</span></span> <span><span>(<span class="type-var">'k</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.create ()</code> creates an ephemeron with one key. The data and the key are empty</p><ul class="at-tags"><li class="alert"><span class="at-tag">alert</span> old_ephemeron_api This function won't be available in 5.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_key"><a href="#val-get_key" class="anchor"></a><code><span><span class="keyword">val</span> get_key : <span><span><span>(<span class="type-var">'k</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'k</span> option</span></span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.get_key eph</code> returns <code>None</code> if the key of <code>eph</code> is empty, <code>Some x</code> (where <code>x</code> is the key) if it is full.</p><ul class="at-tags"><li class="alert"><span class="at-tag">alert</span> old_ephemeron_api This function won't be available in 5.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_key_copy"><a href="#val-get_key_copy" class="anchor"></a><code><span><span class="keyword">val</span> get_key_copy : <span><span><span>(<span class="type-var">'k</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'k</span> option</span></span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.get_key_copy eph</code> returns <code>None</code> if the key of <code>eph</code> is empty, <code>Some x</code> (where <code>x</code> is a (shallow) copy of the key) if it is full. This function has the same GC friendliness as <a href="../../Weak/index.html#val-get_copy"><code>Weak.get_copy</code></a></p><p>If the element is a custom block it is not copied.</p><ul class="at-tags"><li class="alert"><span class="at-tag">alert</span> old_ephemeron_api This function won't be available in 5.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_key"><a href="#val-set_key" class="anchor"></a><code><span><span class="keyword">val</span> set_key : <span><span><span>(<span class="type-var">'k</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'k</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.set_key eph el</code> sets the key of <code>eph</code> to be a (full) key to <code>el</code></p><ul class="at-tags"><li class="alert"><span class="at-tag">alert</span> old_ephemeron_api This function won't be available in 5.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-unset_key"><a href="#val-unset_key" class="anchor"></a><code><span><span class="keyword">val</span> unset_key : <span><span><span>(<span class="type-var">'k</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.unset_key eph el</code> sets the key of <code>eph</code> to be an empty key. Since there is only one key, the ephemeron starts behaving like a reference on the data.</p><ul class="at-tags"><li class="alert"><span class="at-tag">alert</span> old_ephemeron_api This function won't be available in 5.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-check_key"><a href="#val-check_key" class="anchor"></a><code><span><span class="keyword">val</span> check_key : <span><span><span>(<span class="type-var">'k</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.check_key eph</code> returns <code>true</code> if the key of the <code>eph</code> is full, <code>false</code> if it is empty. Note that even if <code>Ephemeron.K1.check_key eph</code> returns <code>true</code>, a subsequent <a href="#val-get_key"><code>Ephemeron.K1.get_key</code></a><code>eph</code> can return <code>None</code>.</p><ul class="at-tags"><li class="alert"><span class="at-tag">alert</span> old_ephemeron_api This function won't be available in 5.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-blit_key"><a href="#val-blit_key" class="anchor"></a><code><span><span class="keyword">val</span> blit_key : <span><span><span>(<span class="type-var">'k</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span>(<span class="type-var">'k</span>, <span class="type-var">_</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.blit_key eph1 eph2</code> sets the key of <code>eph2</code> with the key of <code>eph1</code>. Contrary to using <a href="#val-get_key"><code>Ephemeron.K1.get_key</code></a> followed by <a href="#val-set_key"><code>Ephemeron.K1.set_key</code></a> or <a href="#val-unset_key"><code>Ephemeron.K1.unset_key</code></a> this function does not prevent the incremental GC from erasing the value in its current cycle.</p><ul class="at-tags"><li class="alert"><span class="at-tag">alert</span> old_ephemeron_api This function won't be available in 5.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_data"><a href="#val-get_data" class="anchor"></a><code><span><span class="keyword">val</span> get_data : <span><span><span>(<span class="type-var">'k</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'d</span> option</span></span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.get_data eph</code> returns <code>None</code> if the data of <code>eph</code> is empty, <code>Some x</code> (where <code>x</code> is the data) if it is full.</p><ul class="at-tags"><li class="alert"><span class="at-tag">alert</span> old_ephemeron_api This function won't be available in 5.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-get_data_copy"><a href="#val-get_data_copy" class="anchor"></a><code><span><span class="keyword">val</span> get_data_copy : <span><span><span>(<span class="type-var">'k</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'d</span> option</span></span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.get_data_copy eph</code> returns <code>None</code> if the data of <code>eph</code> is empty, <code>Some x</code> (where <code>x</code> is a (shallow) copy of the data) if it is full. This function has the same GC friendliness as <a href="../../Weak/index.html#val-get_copy"><code>Weak.get_copy</code></a></p><p>If the element is a custom block it is not copied.</p><ul class="at-tags"><li class="alert"><span class="at-tag">alert</span> old_ephemeron_api This function won't be available in 5.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_data"><a href="#val-set_data" class="anchor"></a><code><span><span class="keyword">val</span> set_data : <span><span><span>(<span class="type-var">'k</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'d</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.set_data eph el</code> sets the data of <code>eph</code> to be a (full) data to <code>el</code></p><ul class="at-tags"><li class="alert"><span class="at-tag">alert</span> old_ephemeron_api This function won't be available in 5.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-unset_data"><a href="#val-unset_data" class="anchor"></a><code><span><span class="keyword">val</span> unset_data : <span><span><span>(<span class="type-var">'k</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.unset_data eph el</code> sets the key of <code>eph</code> to be an empty key. The ephemeron starts behaving like a weak pointer.</p><ul class="at-tags"><li class="alert"><span class="at-tag">alert</span> old_ephemeron_api This function won't be available in 5.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-check_data"><a href="#val-check_data" class="anchor"></a><code><span><span class="keyword">val</span> check_data : <span><span><span>(<span class="type-var">'k</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.check_data eph</code> returns <code>true</code> if the data of the <code>eph</code> is full, <code>false</code> if it is empty. Note that even if <code>Ephemeron.K1.check_data eph</code> returns <code>true</code>, a subsequent <a href="#val-get_data"><code>Ephemeron.K1.get_data</code></a><code>eph</code> can return <code>None</code>.</p><ul class="at-tags"><li class="alert"><span class="at-tag">alert</span> old_ephemeron_api This function won't be available in 5.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-blit_data"><a href="#val-blit_data" class="anchor"></a><code><span><span class="keyword">val</span> blit_data : <span><span><span>(<span class="type-var">_</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span>(<span class="type-var">_</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.blit_data eph1 eph2</code> sets the data of <code>eph2</code> with the data of <code>eph1</code>. Contrary to using <a href="#val-get_data"><code>Ephemeron.K1.get_data</code></a> followed by <a href="#val-set_data"><code>Ephemeron.K1.set_data</code></a> or <a href="#val-unset_data"><code>Ephemeron.K1.unset_data</code></a> this function does not prevent the incremental GC from erasing the value in its current cycle.</p><ul class="at-tags"><li class="alert"><span class="at-tag">alert</span> old_ephemeron_api This function won't be available in 5.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-make"><a href="#val-make" class="anchor"></a><code><span><span class="keyword">val</span> make : <span><span class="type-var">'k</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'d</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span class="type-var">'k</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.make k d</code> creates an ephemeron with key <code>k</code> and data <code>d</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-query"><a href="#val-query" class="anchor"></a><code><span><span class="keyword">val</span> query : <span><span><span>(<span class="type-var">'k</span>, <span class="type-var">'d</span>)</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'k</span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'d</span> option</span></span></code></div><div class="spec-doc"><p><code>Ephemeron.K1.query eph key</code> returns <code>Some x</code> (where <code>x</code> is the ephemeron's data) if <code>key</code> is physically equal to <code>eph</code>'s key, and <code>None</code> if <code>eph</code> is empty or <code>key</code> is not equal to <code>eph</code>'s key.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Make"><a href="#module-Make" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Make/index.html">Make</a></span><span> (<a href="Make/argument-1-H/index.html">H</a> : <a href="../../Hashtbl/module-type-HashedType/index.html">Hashtbl.HashedType</a>) : <a href="../module-type-S/index.html">S</a> <span class="keyword">with</span> <span><span class="keyword">type</span> <a href="../module-type-S/index.html#type-key">key</a> = <a href="Make/argument-1-H/index.html#type-t">H.t</a></span></span></code></div><div class="spec-doc"><p>Functor building an implementation of a weak hash table</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-MakeSeeded"><a href="#module-MakeSeeded" class="anchor"></a><code><span><span class="keyword">module</span> <a href="MakeSeeded/index.html">MakeSeeded</a></span><span> (<a href="MakeSeeded/argument-1-H/index.html">H</a> : <a href="../../Hashtbl/module-type-SeededHashedType/index.html">Hashtbl.SeededHashedType</a>) : <a href="../module-type-SeededS/index.html">SeededS</a> <span class="keyword">with</span> <span><span class="keyword">type</span> <a href="../module-type-SeededS/index.html#type-key">key</a> = <a href="MakeSeeded/argument-1-H/index.html#type-t">H.t</a></span></span></code></div><div class="spec-doc"><p>Functor building an implementation of a weak hash table. The seed is similar to the one of <a href="../../Hashtbl/MakeSeeded/index.html"><code>Hashtbl.MakeSeeded</code></a>.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Bucket"><a href="#module-Bucket" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Bucket/index.html">Bucket</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div></div></div></body></html>