Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Httpaf.Bigstring
SourceBigstring
A block of memory allocated on the C heap. Bigstring payloads won't get relocated by the OCaml GC, making it safe to use in blocking system calls without holding the OCaml runtime lock.
For compatiblity with other libraries, Bigstring.t
is not abstract.
of_string ?off ?len str
allocates a bigstring and copies the contents of str
into it. if off
or len
are provided, t
will only have length len
and only the specified range of the string will be copied into it.
get t n
returns the nth byte of t
as a char
. unsafe_get t n
does the same but will not perform bounds checking.
set t n
returns the nth byte of t
as a char
. unsafe_set t n
does the same but will not perform bounds checking.
sub ~off ?len t
returns a sub-view into the bigstring t
, specified by off
and len
. This is a non-copying operation: t
and the returned sub-view will share underlying bytes. Modifying one will modify the other.