This commit is contained in:
c-cube 2023-08-09 03:13:40 +00:00
parent f8534f68f3
commit 59db1512c3

View file

@ -1,2 +1,2 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Writer (tiny_httpd.Tiny_httpd_io.Writer)</title><link rel="stylesheet" href="../../../odoc.support/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="../../../odoc.support/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">tiny_httpd</a> &#x00BB; <a href="../index.html">Tiny_httpd_io</a> &#x00BB; Writer</nav><header class="odoc-preamble"><h1>Module <code><span>Tiny_httpd_io.Writer</span></code></h1><p>A writer abstraction.</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> t</span><span> = </span><span>{</span></code><ol><li id="type-t.write" class="def record field anchored"><a href="#type-t.write" class="anchor"></a><code><span>write : <span><a href="../Output/index.html#type-t">Output.t</a> <span class="arrow">&#45;&gt;</span></span> unit;</span></code></li></ol><code><span>}</span></code></div><div class="spec-doc"><p>Writer.</p><p>A writer is a push-based stream of bytes. Give it an output channel and it will write the bytes in it.</p><p>This is useful for responses: an http endpoint can return a writer as its response's body, and output into it as if it were a regular <code>out_channel</code>, including controlling calls to <code>flush</code>.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.14</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>write:<span>(<span><a href="../Output/index.html#type-t">Output.t</a> <span class="arrow">&#45;&gt;</span></span> unit)</span> <span class="arrow">&#45;&gt;</span></span> <span>unit <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-write"><a href="#val-write" class="anchor"></a><code><span><span class="keyword">val</span> write : <span><a href="../Output/index.html#type-t">Output.t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Write into the channel.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-empty"><a href="#val-empty" class="anchor"></a><code><span><span class="keyword">val</span> empty : <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Empty writer, will output 0 bytes.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-of_string"><a href="#val-of_string" class="anchor"></a><code><span><span class="keyword">val</span> of_string : <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>A writer that just emits the bytes from the given string.</p></div></div></div></body></html> <html xmlns="http://www.w3.org/1999/xhtml"><head><title>Writer (tiny_httpd.Tiny_httpd_io.Writer)</title><link rel="stylesheet" href="../../../odoc.support/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="../../../odoc.support/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">tiny_httpd</a> &#x00BB; <a href="../index.html">Tiny_httpd_io</a> &#x00BB; Writer</nav><header class="odoc-preamble"><h1>Module <code><span>Tiny_httpd_io.Writer</span></code></h1><p>A writer abstraction.</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> t</span><span> = </span><span>{</span></code><ol><li id="type-t.write" class="def record field anchored"><a href="#type-t.write" class="anchor"></a><code><span>write : <span><a href="../Output/index.html#type-t">Output.t</a> <span class="arrow">&#45;&gt;</span></span> unit;</span></code></li></ol><code><span>}</span></code></div><div class="spec-doc"><p>Writer.</p><p>A writer is a push-based stream of bytes. Give it an output channel and it will write the bytes in it.</p><p>This is useful for responses: an http endpoint can return a writer as its response's body; the writer is given access to the connection to the client and can write into it as if it were a regular <code>out_channel</code>, including controlling calls to <code>flush</code>. Tiny_httpd will convert these writes into valid HTTP chunks.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 0.14</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>write:<span>(<span><a href="../Output/index.html#type-t">Output.t</a> <span class="arrow">&#45;&gt;</span></span> unit)</span> <span class="arrow">&#45;&gt;</span></span> <span>unit <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-write"><a href="#val-write" class="anchor"></a><code><span><span class="keyword">val</span> write : <span><a href="../Output/index.html#type-t">Output.t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Write into the channel.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-empty"><a href="#val-empty" class="anchor"></a><code><span><span class="keyword">val</span> empty : <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Empty writer, will output 0 bytes.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-of_string"><a href="#val-of_string" class="anchor"></a><code><span><span class="keyword">val</span> of_string : <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>A writer that just emits the bytes from the given string.</p></div></div></div></body></html>