module Bigstring:sig..end
A "bigstring" here is simply a bigarray of chars. It can be used instead
of regular strings when IO involve calling C (or another language),
when very large strings are required, or for memory-mapping.
type'agen =unit -> 'a option
type'asequence =('a -> unit) -> unit
type'aprinter =Format.formatter -> 'a -> unit
A "bigstring" here is simply a bigarray of chars. It can be used instead
of regular strings when IO involve calling C (or another language),
when very large strings are required, or for memory-mapping.
typet =(char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
val create : int -> tval empty : tval init : int -> (int -> char) -> tinit n f is the string f 0, f 1, ..., f (n-1).val fill : t -> char -> unitval fill_slice : t -> char -> int -> int -> unitfill_slice s c i len is the same as fill (sub s i len) c, it
fills the slice from i to i+len-1 of s with the char cval size : t -> intval length : t -> intBigstring.size.val get : t -> int -> charInvalid_argument if the index is invalidval unsafe_get : t -> int -> charBigstring.get, but without bound check. Can fail arbitrarily (including
segfault) if used improperly.val set : t -> int -> char -> unitInvalid_argument if the index is invalidval unsafe_set : t -> int -> char -> unitBigstring.set, but without bound check. Can fail arbitrarily (including
segfault) if used improperly.val blit : t -> int -> t -> int -> int -> unitblit s1 i1 s2 i2 len means that elements from s1 whose indices
range from i1 to i1+len-1 are copied into the slots of s2
whose indices range from i2 to i2+len-1. This is similar to
String.blit or Bytes.blit or Array.blit.val copy : t -> tval sub : t -> int -> int -> tsub s i len takes a slice of length len from the string s, starting
at offset i. The slice shares the same memory as s, meaning that
modifications of the slice will modify s as well.
Slicing is cheap since it does not involve copying the whole range.Invalid_argument if i, len doesn't designate a valid substringval fold : ('a -> char -> 'a) -> 'a -> t -> 'aval foldi : ('a -> int -> char -> 'a) -> 'a -> t -> 'aval iter : (char -> unit) -> t -> unitval iteri : (int -> char -> unit) -> t -> unitval equal : t -> t -> boolval compare : t -> t -> intval to_bytes : t -> Bytes.t
val of_bytes : Bytes.t -> t
val of_bytes_slice : Bytes.t -> int -> int -> t
val sub_bytes : t -> int -> int -> Bytes.t
val blit_to_bytes : t -> int -> Bytes.t -> int -> int -> unit
val blit_of_bytes : Bytes.t -> int -> t -> int -> int -> unit
val blit_of_buffer : Buffer.t -> int -> t -> int -> int -> unit
val to_string : t -> string
val of_string : string -> t
val of_string_slice : string -> int -> int -> t
val of_buffer : Buffer.t -> tof_buffer b creates a string that contains the same as bval of_gen : char gen -> t
val sub_string : t -> int -> int -> string
val blit_of_string : string -> int -> t -> int -> int -> unit
val to_seq : t -> char sequence
val to_gen : t -> char gen
val to_seq_slice : t -> int -> int -> char sequence
val to_gen_slice : t -> int -> int -> char gen
val to_buffer : t -> Buffer.t -> unitval print : t printerval concat : string -> t list -> tconcat set l concatenates the list l, inserting sep between
each pair of string.val map : f:(char -> char) -> t -> t
val mapi : f:(int -> char -> char) -> t -> t
val lowercase : t -> tChar.lowercase)val uppercase : t -> tChar.uppercase)val trim : t -> ttrim s returns a slice of s without the leading and trailing
whitespaces, where whitespaces are defined identically to String.trim.
note that it does not copy the substring, but returns a slice!s, or empty if s is totally composed of whitespacesval index : t -> c:char -> intindex s ~c returns the index of the first
occurrence of character c in string s.Not_found if c does not occurr in sval rindex : t -> c:char -> intrindex s ~c returns the index of the last
occurrence of character c in string s.Not_found if c does not occurr in sval index_pred : f:(char -> bool) -> t -> intindex_pred ~f s returns the index of the first char in s that
satisfies s.Not_found if no character in s satisfies pval rindex_pred : f:(char -> bool) -> t -> intrindex_pred ~f s returns the index of the last char in s that
satisfies s.Not_found if no character in s satisfies pval contains : t -> c:char -> boolString.contains s c tests if character c appears in the string s.val for_all : f:(char -> bool) -> t -> boolval exists : f:(char -> bool) -> t -> boolval split : by:char -> t -> t listsplit s ~by splits s along the occurrences of by.val split_gen : by:char -> t -> t genBigstring.split but returns a generatorval lines : t -> t listlines s returns a list of the lines of s (splits along '\n')val lines_gen : t -> t genlines_gen s returns a generator of the lines of s (splits along '\n')
where every line is a slice of sval with_map_file : ?pos:int64 ->
?len:int ->
?mode:int ->
?flags:Pervasives.open_flag list ->
?shared:bool -> string -> (t -> 'a) -> 'awith_map_file name f maps the file into memory, opening it, and
call f with a slice pos.... pos+len of the bytes of the file
where len is the length of the file if not provided.
When f returns, the file is closed.pos : offset in the file (default 0)mode : the mode for the file, if it's createdflags : opening flags (default rdonly)
see Bigarray.Array1.map_file for more detailsshared : if true, modifications are shared between processes that
have mapped this file (requires the filedescr to be open in write mode).val map_file_descr : ?pos:int64 -> ?shared:bool -> Unix.file_descr -> int -> tmap_file_descr descr len is a lower-level access to an underlying file descriptor.shared : if true, modifications are shared between processes that
have mapped this file (requires the filedescr to be open in write mode).
see Bigarray.Array1.map_file for more details