type t = (char, Bigarray_compat.int8_unsigned_elt, Bigarray_compat.c_layout) Bigarray_compat.Array1.tConstructors
val create : int -> tcreate n returns a bigstring of length n
val empty : tempty is the empty bigstring. It has length 0 and you can't really do much with it, but it's a good placeholder that only needs to be allocated once.
val of_string : off:int -> len:int -> string -> tof_string ~off ~len s returns a bigstring of length len that contains the contents of string from the range [off, len).
copy t ~off ~len allocates a new bigstring of length len and copies the bytes from t copied into it starting from off.
sub t ~off ~len does not allocate a bigstring, but instead returns a new view into t starting at off, and with length len.
Note that this does not allocate a new buffer, but instead shares the buffer of t with the newly-returned bigstring.
Memory-safe Operations
val length : t -> intlength t is the length of the bigstring, in bytes.
val substring : t -> off:int -> len:int -> stringsubstring t ~off ~len returns a string of length len containing the bytes of t starting at off.
val to_string : t -> stringto_string t is equivalent to substring t ~off:0 ~len:(length t)
val get : t -> int -> charget t i returns the character at offset i in t.
val set : t -> int -> char -> unitset t i c sets the character at offset i in t to be c
Little-endian Byte Order
val get_int16_le : t -> int -> intget_int16_le t i returns the two bytes in t starting at offset i, interpreted as an unsigned integer.
val get_int16_sign_extended_le : t -> int -> intget_int16_sign_extended_le t i returns the two bytes in t starting at offset i, interpreted as a signed integer and performing sign extension to the native word size before returning the result.
val set_int16_le : t -> int -> int -> unitset_int16_le t i v sets the two bytes in t starting at offset i to the value v.
val get_int32_le : t -> int -> int32get_int32_le t i returns the four bytes in t starting at offset i.
val set_int32_le : t -> int -> int32 -> unitset_int32_le t i v sets the four bytes in t starting at offset i to the value v.
val get_int64_le : t -> int -> int64get_int64_le t i returns the eight bytes in t starting at offset i.
val set_int64_le : t -> int -> int64 -> unitset_int64_le t i v sets the eight bytes in t starting at offset i to the value v.
Big-endian Byte Order
val get_int16_be : t -> int -> intget_int16_be t i returns the two bytes in t starting at offset i, interpreted as an unsigned integer.
val get_int16_sign_extended_be : t -> int -> intget_int16_sign_extended_be t i returns the two bytes in t starting at offset i, interpreted as a signed integer and performing sign extension to the native word size before returning the result.
val set_int16_be : t -> int -> int -> unitset_int16_be t i v sets the two bytes in t starting at offset off to the value v.
val get_int32_be : t -> int -> int32get_int32_be t i returns the four bytes in t starting at offset i.
val set_int32_be : t -> int -> int32 -> unitset_int32_be t i v sets the four bytes in t starting at offset i to the value v.
val get_int64_be : t -> int -> int64get_int64_be t i returns the eight bytes in t starting at offset i.
val set_int64_be : t -> int -> int64 -> unitset_int64_be t i v sets the eight bytes in t starting at offset i to the value v.
Blits
val blit_from_string : string -> src_off:int -> t -> dst_off:int -> len:int -> unitval blit_from_bytes : Stdlib.Bytes.t -> src_off:int -> t -> dst_off:int -> len:int -> unitval blit_to_bytes : t -> src_off:int -> Stdlib.Bytes.t -> dst_off:int -> len:int -> unitmemcmp
val memcmp_string : t -> int -> string -> int -> int -> intMemory-unsafe Operations
val unsafe_set : t -> int -> char -> unitunsafe_set t i c is like set except no bounds checking is performed.
val unsafe_get_int16_le : t -> int -> intunsafe_get_int16_le t i is like get_int16_le except no bounds checking is performed.
val unsafe_get_int16_be : t -> int -> intunsafe_get_int16_be t i is like get_int16_be except no bounds checking is performed.
val unsafe_get_int16_sign_extended_le : t -> int -> intunsafe_get_int16_sign_extended_le t i is like get_int16_sign_extended_le except no bounds checking is performed.
val unsafe_get_int16_sign_extended_be : t -> int -> intunsafe_get_int16_sign_extended_be t i is like get_int16_sign_extended_be except no bounds checking is performed.
val unsafe_set_int16_le : t -> int -> int -> unitunsafe_set_int16_le t i v is like set_int16_le except no bounds checking is performed.
val unsafe_set_int16_be : t -> int -> int -> unitunsafe_set_int16_be t i v is like set_int16_be except no bounds checking is performed.
val unsafe_get_int32_le : t -> int -> int32unsafe_get_int32_le t i is like get_int32_le except no bounds checking is performed.
val unsafe_get_int32_be : t -> int -> int32unsafe_get_int32_be t i is like get_int32_be except no bounds checking is performed.
val unsafe_set_int32_le : t -> int -> int32 -> unitunsafe_set_int32_le t i v is like set_int32_le except no bounds checking is performed.
val unsafe_set_int32_be : t -> int -> int32 -> unitunsafe_set_int32_be t i v is like set_int32_be except no bounds checking is performed.
val unsafe_get_int64_le : t -> int -> int64unsafe_get_int64_le t i is like get_int64_le except no bounds checking is performed.
val unsafe_get_int64_be : t -> int -> int64unsafe_get_int64_be t i is like get_int64_be except no bounds checking is performed.
val unsafe_set_int64_le : t -> int -> int64 -> unitunsafe_set_int64_le t i v is like set_int64_le except no bounds checking is performed.
val unsafe_set_int64_be : t -> int -> int64 -> unitunsafe_set_int64_be t i v is like set_int64_be except no bounds checking is performed.
Blits
val unsafe_blit_from_string : string -> src_off:int -> t -> dst_off:int -> len:int -> unitval unsafe_blit_from_bytes : Stdlib.Bytes.t -> src_off:int -> t -> dst_off:int -> len:int -> unitval unsafe_blit_to_bytes : t -> src_off:int -> Stdlib.Bytes.t -> dst_off:int -> len:int -> unitmemcmp
val unsafe_memcmp_string : t -> int -> string -> int -> int -> int