package shexp
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=b2ca616e5384d517a3bef878ed2fd364b2c51993f7f57f223954422e2eea0e1d
md5=d48e292eaa2f7e4f66fa5381eddc86a9
doc/shexp.bigstring/Shexp_bigstring/Bigstring/index.html
Module Shexp_bigstring.Bigstring
Bigstring helpers for shexp libraries
type t =
(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.tval create : int -> tval length : t -> intval blit_string_t :
src:string ->
src_pos:int ->
dst:t ->
dst_pos:int ->
len:int ->
unitval sub_string : t -> pos:int -> len:int -> stringval index : t -> pos:int -> len:int -> char:char -> int optionval rindex : t -> pos:int -> len:int -> char:char -> int optionEfficiently checks that the range denoted by (pos, len) is in the range 0..length. length is assumed to be >= 0.
Raises if (pos, len) denotes a range outside of 0..length.
val with_temporary : size:int -> f:(t -> 'a) -> 'aAllocate a bigstring and pass it to f. The memory allocated for the bigstring is released as soon as f returns. As such, the bigstring shouldn't be used after f returns.
This is more efficient than waiting on the garbage collector to release the external memory.
val fold_temporary :
size:int ->
init:'a ->
f:(t -> 'a -> ('a, 'b) fold_temporary_result) ->
'bSame as with_temporary, but allow to resize the bigstring if needed.
If f returns Resize { new_size; state }, the bigstring will be resized to the given new size and f will be called with the new bigstring and state. The contents of the bigstring up to the min of the old and new sizes is preserved.