ocaml-opentelemetry/eio/Eio_mock/Handler/index.html
2026-04-06 19:57:49 +00:00

2 lines
4.2 KiB
HTML
Raw Permalink 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>Handler (eio.Eio_mock.Handler)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 3.1.0"/><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">Index</a> &#x00BB; <a href="../../index.html">eio</a> &#x00BB; <a href="../index.html">Eio_mock</a> &#x00BB; Handler</nav><header class="odoc-preamble"><h1>Module <code><span>Eio_mock.Handler</span></code></h1><p>Control how a mock responds.</p><p>This module is mostly useful when writing custom mocks. Individual mocks usually provide convenience wrappers around this.</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>'a t</span></span></code></div><div class="spec-doc"><p>A handler that provides values of type <code>'a</code>.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-actions"><a href="#type-actions" class="anchor"></a><code><span><span class="keyword">type</span> <span>'a actions</span></span><span> = <span><span><span class="type-var">'a</span> <a href="../Action/index.html#type-t">Action.t</a></span> list</span></span></code></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><span class="type-var">'a</span> <a href="../Action/index.html#type-t">Action.t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>make default_action</code> is a new handler that initially always runs <code>default_action</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_handler"><a href="#val-set_handler" class="anchor"></a><code><span><span class="keyword">val</span> set_handler : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<span>unit <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span>)</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>set_handler t fn</code> sets (replaces) the function to be called whenever the handler is run.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-seq"><a href="#val-seq" class="anchor"></a><code><span><span class="keyword">val</span> seq : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> <a href="#type-actions">actions</a></span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>seq t actions</code> sets a handler function that performs the next action in <code>actions</code> on each call. When there are no more actions, it runs the default handler.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-run"><a href="#val-run" class="anchor"></a><code><span><span class="keyword">val</span> run : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>run t</code> is used by mocks to run their handlers.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-run_default_action"><a href="#val-run_default_action" class="anchor"></a><code><span><span class="keyword">val</span> run_default_action : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span class="type-var">'a</span></span></code></div><div class="spec-doc"><p><code>run_default_action t</code> runs the default handler passed to <a href="#val-make"><code>make</code></a>.</p></div></div></div></body></html>