package core_kernel
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=fd2b8c6715794df7a810a62b226f53720f211cd344b4afc9fab0498796d6b466
doc/core_kernel.iobuf/Iobuf/Expert/index.html
Module Iobuf.Expert
Source
The Expert
module is for building efficient out-of-module Iobuf
abstractions.
These accessors will not allocate, and are mainly here to assist in building low-cost syscall wrappers.
One must be careful to avoid writing out of the limits (between lo_min
and hi_max
) of the buf
. Doing so would violate the invariants of the parent Iobuf
.
These setters directly set fields in t
without checking any invariants.
to_bigstring_shared t
and to_iobuf_shared t
allocate new wrappers around the storage of buf t
, relative to t
's current bounds.
These operations allow access outside the bounds and limits of t
, and without respect to its read/write access. Be careful not to violate t
's invariants.
reinitialize_of_bigstring t bigstring
reinitializes t
with backing bigstring
, and the window and limits specified starting at pos
and of length len
.
val unsafe_reinitialize :
(_, _) t ->
lo_min:int ->
lo:int ->
hi:int ->
hi_max:int ->
Core.Bigstring.t ->
unit
As reinitialize_of_bigstring
but without checking, and requires explicit specification of bounds.
These versions of set_bounds_and_buffer
allow ~src
to be read-only. ~dst
will be writable through ~src
aliases even though the type does not reflect this!
Similar to protect_window_bounds_and_buffer
, but does not save/restore the buffer or bounds. Mixing this with functions like set_bounds_and_buffer
or narrow
is unsafe; you should not modify anyything but the window inside f
.
As protect_window
but does not enforce that the closure should not let the buffer escape. Letting the buffer escape is dangerous and almost certainly not what you wanted.
Similar to protect_window
but returns a local value.
Computes the position within buf
for pos
relative to our window. Checks len
bytes are available.