Module Lwt_unix.IO_vectors
Sequences of buffer slices for writev
.
type t
Mutable sequences of I/O vectors. An I/O vector describes a slice of a
bytes
orBigarray
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.
type _bigarray
= (char, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t
Type abbreviation equivalent to
Lwt_bytes.t
. Do not use this type name directly; useLwt_bytes.t
instead.
val create : unit -> t
Creates an empty I/O vector sequence.
val append_bytes : t -> bytes -> int -> int -> unit
append_bytes vs buffer offset length
appends a slice of thebytes
bufferbuffer
beginning atoffset
and with lengthlength
to the I/O vector sequencevs
.
val append_bigarray : t -> _bigarray -> int -> int -> unit
append_bigarray vs buffer offset length
appends a slice of theBigarray
bufferbuffer
beginning atoffset
and with lengthlength
to the I/O vector sequencevs
.
val drop : t -> int -> unit
drop vs n
adjusts the I/O vector sequencevs
so that it no longer includes its firstn
bytes.
val is_empty : t -> bool
is_empty vs
istrue
if and only ifvs
has no I/O vectors, or all I/O vectors invs
have zero bytes.
val byte_count : t -> int
byte_count vs
is the total number of bytes invs
.- since
- 4.2.0
val system_limit : int option
Some systems limit the number of I/O vectors that can be passed in a single call to their
writev
orreadv
system calls. On those systems, if the limit isn
, this value is equal toSome n
. On systems without such a limit, the value is equal toNone
.Unless you need atomic I/O operations, you can ignore this limit. The Lwt binding automatically respects it internally. See
Lwt_unix.writev
.A typical limit is 1024 vectors.