moonpool/lwt/Lwt_unix/IO_vectors/index.html
2025-09-26 19:08:06 +00:00

4 lines
6.1 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>IO_vectors (lwt.Lwt_unix.IO_vectors)</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">lwt</a> &#x00BB; <a href="../index.html">Lwt_unix</a> &#x00BB; IO_vectors</nav><header class="odoc-preamble"><h1>Module <code><span>Lwt_unix.IO_vectors</span></code></h1><p>Sequences of buffer slices for <a href="../index.html#val-writev"><code>writev</code></a>.</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></code></div><div class="spec-doc"><p>Mutable sequences of I/O vectors. An I/O vector describes a slice of a <code>bytes</code> or <code>Bigarray</code> buffer. Each I/O vector is a triple containing a reference to the buffer, an offset into the buffer where the slice begins, and the length of the slice.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-_bigarray"><a href="#type-_bigarray" class="anchor"></a><code><span><span class="keyword">type</span> _bigarray</span><span> =
<span><span>(char, <a href="../../../ocaml/Stdlib/Bigarray/index.html#type-int8_unsigned_elt">Stdlib.Bigarray.int8_unsigned_elt</a>, <a href="../../../ocaml/Stdlib/Bigarray/index.html#type-c_layout">Stdlib.Bigarray.c_layout</a>)</span>
<a href="../../../ocaml/Stdlib/Bigarray/Array1/index.html#type-t">Stdlib.Bigarray.Array1.t</a></span></span></code></div><div class="spec-doc"><p>Type abbreviation equivalent to <a href="../../Lwt_bytes/index.html#type-t"><code>Lwt_bytes.t</code></a>. Do not use this type name directly; use <a href="../../Lwt_bytes/index.html#type-t"><code>Lwt_bytes.t</code></a> instead.</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> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Creates an empty I/O vector sequence.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-append_bytes"><a href="#val-append_bytes" class="anchor"></a><code><span><span class="keyword">val</span> append_bytes : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>bytes <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>append_bytes vs buffer offset length</code> appends a slice of the <code>bytes</code> buffer <code>buffer</code> beginning at <code>offset</code> and with length <code>length</code> to the I/O vector sequence <code>vs</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-append_bigarray"><a href="#val-append_bigarray" class="anchor"></a><code><span><span class="keyword">val</span> append_bigarray : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-_bigarray">_bigarray</a> <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>append_bigarray vs buffer offset length</code> appends a slice of the <code>Bigarray</code> buffer <code>buffer</code> beginning at <code>offset</code> and with length <code>length</code> to the I/O vector sequence <code>vs</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-drop"><a href="#val-drop" class="anchor"></a><code><span><span class="keyword">val</span> drop : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p><code>drop vs n</code> adjusts the I/O vector sequence <code>vs</code> so that it no longer includes its first <code>n</code> bytes.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-is_empty"><a href="#val-is_empty" class="anchor"></a><code><span><span class="keyword">val</span> is_empty : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p><code>is_empty vs</code> is <code>true</code> if and only if <code>vs</code> has no I/O vectors, or all I/O vectors in <code>vs</code> have zero bytes.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-byte_count"><a href="#val-byte_count" class="anchor"></a><code><span><span class="keyword">val</span> byte_count : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p><code>byte_count vs</code> is the total number of bytes in <code>vs</code>.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 4.2.0</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-system_limit"><a href="#val-system_limit" class="anchor"></a><code><span><span class="keyword">val</span> system_limit : <span>int option</span></span></code></div><div class="spec-doc"><p>Some systems limit the number of I/O vectors that can be passed in a single call to their <code>writev</code> or <code>readv</code> system calls. On those systems, if the limit is <code>n</code>, this value is equal to <code>Some n</code>. On systems without such a limit, the value is equal to <code>None</code>.</p><p>Unless you need atomic I/O operations, you can ignore this limit. The Lwt binding automatically respects it internally. See <a href="../index.html#val-writev"><code>Lwt_unix.writev</code></a>.</p><p>A typical limit is 1024 vectors.</p></div></div></div></body></html>