Module Core__.Bigstring
include module type of sig ... end
type t= (Core_kernel__.Import.char, Stdlib.Bigarray.int8_unsigned_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.ttype t_frozen= t
val compare : t -> t -> Base.intval t_of_sexp : Sexplib0.Sexp.t -> tval sexp_of_t : t -> Sexplib0.Sexp.tval compare_t_frozen : t_frozen -> t_frozen -> Base.intval hash_fold_t_frozen : Base.Hash.state -> t_frozen -> Base.Hash.stateval hash_t_frozen : t_frozen -> Base.Hash.hash_valueval sexp_of_t_frozen : t_frozen -> Ppx_sexp_conv_lib.Sexp.tval t_frozen_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> t_frozenval equal : t Base.Equal.equalval init : Base.int -> f:(Base.int -> Base.char) -> tval of_string : ?pos:Base.int -> ?len:Base.int -> Base.string -> tval of_bytes : ?pos:Base.int -> ?len:Base.int -> Base.bytes -> tval to_string : ?pos:Base.int -> ?len:Base.int -> t -> Base.stringval to_bytes : ?pos:Base.int -> ?len:Base.int -> t -> Base.bytesval concat : ?sep:t -> t Base.list -> tval check_args : loc:Base.string -> pos:Base.int -> len:Base.int -> t -> Base.unitval get_opt_len : t -> pos:Base.int -> Base.int Base.option -> Base.intval length : t -> Base.int
val get : t -> Base.int -> Base.charval set : t -> Base.int -> Base.char -> Base.unitval is_mmapped : t -> Base.bool
val blit : (t, t) Base__.Blit_intf.blitval blito : (t, t) Base__.Blit_intf.blitoval unsafe_blit : (t, t) Base__.Blit_intf.blitval sub : (t, t) Base__.Blit_intf.subval subo : (t, t) Base__.Blit_intf.suboval copy : t -> t
module To_bytes = Core_kernel__Bigstring.To_bytesval memset : t -> pos:Base.int -> len:Base.int -> Base.char -> Base.unitval memcmp : t -> pos1:Base.int -> t -> pos2:Base.int -> len:Base.int -> Base.intval find : ?pos:Base.int -> ?len:Base.int -> Base.char -> t -> Base.int Base.option
val get_int8 : t -> pos:Base.int -> Base.intval set_int8_exn : t -> pos:Base.int -> Base.int -> Base.unitval get_uint8 : t -> pos:Base.int -> Base.intval set_uint8_exn : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_get_int8 : t -> pos:Base.int -> Base.intval unsafe_set_int8 : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_get_uint8 : t -> pos:Base.int -> Base.intval unsafe_set_uint8 : t -> pos:Base.int -> Base.int -> Base.unitval get_int16_le : t -> pos:Base.int -> Base.intval get_int16_be : t -> pos:Base.int -> Base.intval set_int16_le_exn : t -> pos:Base.int -> Base.int -> Base.unitval set_int16_be_exn : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_get_int16_le : t -> pos:Base.int -> Base.intval unsafe_get_int16_be : t -> pos:Base.int -> Base.intval unsafe_set_int16_le : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_set_int16_be : t -> pos:Base.int -> Base.int -> Base.unitval get_uint16_le : t -> pos:Base.int -> Base.intval get_uint16_be : t -> pos:Base.int -> Base.intval set_uint16_le_exn : t -> pos:Base.int -> Base.int -> Base.unitval set_uint16_be_exn : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_get_uint16_le : t -> pos:Base.int -> Base.intval unsafe_get_uint16_be : t -> pos:Base.int -> Base.intval unsafe_set_uint16_le : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_set_uint16_be : t -> pos:Base.int -> Base.int -> Base.unitval get_int32_le : t -> pos:Base.int -> Base.intval get_int32_be : t -> pos:Base.int -> Base.intval set_int32_le_exn : t -> pos:Base.int -> Base.int -> Base.unitval set_int32_be_exn : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_get_int32_le : t -> pos:Base.int -> Base.intval unsafe_get_int32_be : t -> pos:Base.int -> Base.intval unsafe_set_int32_le : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_set_int32_be : t -> pos:Base.int -> Base.int -> Base.unitval get_uint32_le : t -> pos:Base.int -> Base.intval get_uint32_be : t -> pos:Base.int -> Base.intval set_uint32_le_exn : t -> pos:Base.int -> Base.int -> Base.unitval set_uint32_be_exn : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_get_uint32_le : t -> pos:Base.int -> Base.intval unsafe_get_uint32_be : t -> pos:Base.int -> Base.intval unsafe_set_uint32_le : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_set_uint32_be : t -> pos:Base.int -> Base.int -> Base.unitval get_int64_le_exn : t -> pos:Base.int -> Base.intval get_int64_be_exn : t -> pos:Base.int -> Base.intval get_int64_le_trunc : t -> pos:Base.int -> Base.intval get_int64_be_trunc : t -> pos:Base.int -> Base.intval set_int64_le : t -> pos:Base.int -> Base.int -> Base.unitval set_int64_be : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_get_int64_le_exn : t -> pos:Base.int -> Base.intval unsafe_get_int64_be_exn : t -> pos:Base.int -> Base.intval unsafe_get_int64_le_trunc : t -> pos:Base.int -> Base.intval unsafe_get_int64_be_trunc : t -> pos:Base.int -> Base.intval unsafe_set_int64_le : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_set_int64_be : t -> pos:Base.int -> Base.int -> Base.unitval get_uint64_be_exn : t -> pos:Base.int -> Base.intval get_uint64_le_exn : t -> pos:Base.int -> Base.intval set_uint64_le_exn : t -> pos:Base.int -> Base.int -> Base.unitval set_uint64_be_exn : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_get_uint64_be_exn : t -> pos:Base.int -> Base.intval unsafe_get_uint64_le_exn : t -> pos:Base.int -> Base.intval unsafe_set_uint64_le : t -> pos:Base.int -> Base.int -> Base.unitval unsafe_set_uint64_be : t -> pos:Base.int -> Base.int -> Base.unitval get_int32_t_le : t -> pos:Base.int -> Base.Int32.tval get_int32_t_be : t -> pos:Base.int -> Base.Int32.tval set_int32_t_le : t -> pos:Base.int -> Base.Int32.t -> Base.unitval set_int32_t_be : t -> pos:Base.int -> Base.Int32.t -> Base.unitval unsafe_get_int32_t_le : t -> pos:Base.int -> Base.Int32.tval unsafe_get_int32_t_be : t -> pos:Base.int -> Base.Int32.tval unsafe_set_int32_t_le : t -> pos:Base.int -> Base.Int32.t -> Base.unitval unsafe_set_int32_t_be : t -> pos:Base.int -> Base.Int32.t -> Base.unitval get_int64_t_le : t -> pos:Base.int -> Base.Int64.tval get_int64_t_be : t -> pos:Base.int -> Base.Int64.tval set_int64_t_le : t -> pos:Base.int -> Base.Int64.t -> Base.unitval set_int64_t_be : t -> pos:Base.int -> Base.Int64.t -> Base.unitval unsafe_get_int64_t_le : t -> pos:Base.int -> Base.Int64.tval unsafe_get_int64_t_be : t -> pos:Base.int -> Base.Int64.tval unsafe_set_int64_t_le : t -> pos:Base.int -> Base.Int64.t -> Base.unitval unsafe_set_int64_t_be : t -> pos:Base.int -> Base.Int64.t -> Base.unit
module Private = Core_kernel__Bigstring.Privatemodule Hexdump = Core_kernel__Bigstring.Hexdumpval create : ?max_mem_waiting_gc:Core_kernel.Byte_units.t -> Core_kernel__.Import.int -> tval write_bin_prot : t -> ?pos:Core_kernel__.Import.int -> 'a Bin_prot.Type_class.writer -> 'a -> Core_kernel__.Import.intval read_bin_prot : t -> ?pos:Core_kernel__.Import.int -> ?len:Core_kernel__.Import.int -> 'a Bin_prot.Type_class.reader -> ('a * Core_kernel__.Import.int) Core_kernel.Or_error.tval read_bin_prot_verbose_errors : t -> ?pos:Core_kernel__.Import.int -> ?len:Core_kernel__.Import.int -> 'a Bin_prot.Type_class.reader -> [ `Invalid_data of Core_kernel.Error.t | `Not_enough_data | `Ok of 'a * Core_kernel__.Import.int ]
val unsafe_destroy : t -> Core_kernel__.Import.unitval unsafe_destroy_and_resize : t -> len:Core_kernel__.Import.int -> t
val get_tail_padded_fixed_string : padding:Core_kernel__.Import.char -> t -> pos:Core_kernel__.Import.int -> len:Core_kernel__.Import.int -> Core_kernel__.Import.unit -> Core_kernel__.Import.stringval set_tail_padded_fixed_string : padding:Core_kernel__.Import.char -> t -> pos:Core_kernel__.Import.int -> len:Core_kernel__.Import.int -> Core_kernel__.Import.string -> Core_kernel__.Import.unitval get_head_padded_fixed_string : padding:Core_kernel__.Import.char -> t -> pos:Core_kernel__.Import.int -> len:Core_kernel__.Import.int -> Core_kernel__.Import.unit -> Core_kernel__.Import.stringval set_head_padded_fixed_string : padding:Core_kernel__.Import.char -> t -> pos:Core_kernel__.Import.int -> len:Core_kernel__.Import.int -> Core_kernel__.Import.string -> Core_kernel__.Import.unit
module Unstable = Core_kernel__Bigstring.Unstablemodule Stable = Core_kernel__Bigstring.StableexceptionIOError of int * exnType of I/O errors.
In
IOError (n, exn),nis the number of bytes successfully read/written before the error andexnis the exception that occurred (e.g.,Unix_error,End_of_file)
Input functions
val read : ?min_len:int -> Unix.file_descr -> ?pos:int -> ?len:int -> t -> intread ?min_len fd ?pos ?len bstrreads at leastmin_len(must be>= 0) and at mostlen(must be>= min_len) bytes from file descriptorfd, and writes them to bigstringbstrstarting at positionpos. Returns the number of bytes actually read.readreturns zero only iflen = 0. Iflen > 0and there's nothing left to read,readraises to indicate EOF even ifmin_len = 0.NOTE: Even if
lenis zero, there may still be errors when reading from the descriptor!Raises
Invalid_argumentif the designated ranges are out of bounds. RaisesIOErrorin the case of input errors, or on EOF if the minimum length could not be read.
val really_read : Unix.file_descr -> ?pos:int -> ?len:int -> t -> unitreally_read fd ?pos ?len bstrreadslenbytes from file descriptorfd, and writes them to bigstringbstrstarting at positionpos.Raises
Invalid_argumentif the designated range is out of bounds. RaisesIOErrorin the case of input errors, or on EOF.
val really_recv : Unix.file_descr -> ?pos:int -> ?len:int -> t -> unitreally_recv sock ?pos ?len bstrreceiveslenbytes from socketsock, and writes them to bigstringbstrstarting at positionpos. Iflenis zero, the function returns immediately without performing the underlying system call.Raises
Invalid_argumentif the designated range is out of bounds. RaisesIOErrorin the case of input errors, or on EOF.
val recvfrom_assume_fd_is_nonblocking : Unix.file_descr -> ?pos:int -> ?len:int -> t -> int * Unix.sockaddrrecvfrom_assume_fd_is_nonblocking sock ?pos ?len bstrreads up tolenbytes into bigstringbstrstarting at positionposfrom socketsockwithout yielding to other OCaml-threads.Returns the number of bytes actually read and the socket address of the client.
Raises
Unix_errorin the case of input errors. RaisesInvalid_argumentif the designated range is out of bounds.
val read_assume_fd_is_nonblocking : Unix.file_descr -> ?pos:int -> ?len:int -> t -> Core__.Syscall_result.Int.tread_assume_fd_is_nonblocking fd ?pos ?len bstrreads up tolenbytes into bigstringbstrstarting at positionposfrom file descriptorfdwithout yielding to other OCaml-threads. Returns the number of bytes actually read.Raises
Invalid_argumentif the designated range is out of bounds.
val pread_assume_fd_is_nonblocking : Unix.file_descr -> offset:int -> ?pos:int -> ?len:int -> t -> intpread_assume_fd_is_nonblocking fd ~offset ?pos ?len bstrreads up tolenbytes from file descriptorfdat offsetoffset, and writes them to bigstringbstrstarting at positionpos. Thefdmust be capable of seeking, and the current file offset used for a regularread()is unchanged. Please seeman preadfor more information. Returns the number of bytes actually read.Raises
Invalid_argumentif the designated range is out of bounds. RaisesUnix_errorin the case of input errors.
val input : ?min_len:int -> Core__.Import.In_channel.t -> ?pos:int -> ?len:int -> t -> intinput ?min_len ic ?pos ?len bstrtries to readlenbytes (guarantees to read at leastmin_lenbytes, which must be>= 0and<= len), if possible, before returning, from input channelic, and writes them to bigstringbstrstarting at positionpos. Returns the number of bytes actually read.NOTE: Even if
lenis zero, there may still be errors when reading from the descriptor, which will be done if the internal buffer is empty!NOTE: If at least
lencharacters are available in the input channel buffer and iflenis not zero, data will only be fetched from the channel buffer. Otherwise data will be read until at leastmin_lencharacters are available.Raises
Invalid_argumentif the designated range is out of bounds. RaisesIOErrorin the case of input errors, or on premature EOF.
val really_input : Core__.Import.In_channel.t -> ?pos:int -> ?len:int -> t -> unitreally_input ic ?pos ?len bstrreads exactlylenbytes from input channelic, and writes them to bigstringbstrstarting at positionpos.Raises
Invalid_argumentif the designated range is out of bounds. RaisesIOErrorin the case of input errors, or on premature EOF.
Output functions
val really_write : Unix.file_descr -> ?pos:int -> ?len:int -> t -> unitreally_write fd ?pos ?len bstrwriteslenbytes in bigstringbstrstarting at positionposto file descriptorfd.Raises
Invalid_argumentif the designated range is out of bounds. RaisesIOErrorin the case of output errors.
val really_send_no_sigpipe : (Unix.file_descr -> ?pos:int -> ?len:int -> t -> unit) Core__.Import.Or_error.treally_send_no_sigpipe sock ?pos ?len bstrsendslenbytes in bigstringbstrstarting at positionposto socketsockwithout blocking and ignoringSIGPIPE.Raises
Invalid_argumentif the designated range is out of bounds. RaisesIOErrorin the case of output errors.really_send_no_sigpipeis not implemented on some platforms, in which case it returns anErrorvalue indicating that it is unimplemented.
val send_nonblocking_no_sigpipe : (Unix.file_descr -> ?pos:int -> ?len:int -> t -> Core__.Syscall_result.Int.t) Core__.Import.Or_error.tsend_nonblocking_no_sigpipe sock ?pos ?len bstrtries to sendlenbytes in bigstringbstrstarting at positionposto socketsock. Returnsbytes_written.Raises
Invalid_argumentif the designated range is out of bounds.
val sendto_nonblocking_no_sigpipe : (Unix.file_descr -> ?pos:int -> ?len:int -> t -> Unix.sockaddr -> Core__.Syscall_result.Int.t) Core__.Import.Or_error.tsendto_nonblocking_no_sigpipe sock ?pos ?len bstr sockaddrtries to sendlenbytes in bigstringbstrstarting at positionposto socketsockusing addressaddr. Returnsbytes_written.Raises
Invalid_argumentif the designated range is out of bounds.
val write : Unix.file_descr -> ?pos:int -> ?len:int -> t -> intwrite fd ?pos ?len bstrwriteslenbytes in bigstringbstrstarting at positionposto file descriptorfd. Returns the number of bytes actually written.Raises
Invalid_argumentif the designated range is out of bounds. RaisesUnix_errorin the case of output errors.
val pwrite_assume_fd_is_nonblocking : Unix.file_descr -> offset:int -> ?pos:int -> ?len:int -> t -> intpwrite_assume_fd_is_nonblocking fd ~offset ?pos ?len bstrwrites up tolenbytes of bigstringbstrstarting at positionposto file descriptorfdat positionoffset. Thefdmust be capable of seeking, and the current file offset used for non-positionalread()/write()calls is unchanged. Returns the number of bytes written.Raises
Invalid_argumentif the designated range is out of bounds. RaisesUnix_errorin the case of output errors.
val write_assume_fd_is_nonblocking : Unix.file_descr -> ?pos:int -> ?len:int -> t -> intwrite_assume_fd_is_nonblocking fd ?pos ?len bstrwriteslenbytes in bigstringbstrstarting at positionposto file descriptorfdwithout yielding to other OCaml-threads. Returns the number of bytes actually written.Raises
Invalid_argumentif the designated range is out of bounds. RaisesUnix_errorin the case of output errors.
val writev : Unix.file_descr -> ?count:int -> t Core__.Core_unix.IOVec.t array -> intwritev fd ?count iovecswritescountiovecsof bigstrings to file descriptorfd. Returns the number of bytes written.Raises
Invalid_argumentifcountis out of range. RaisesUnix_errorin the case of output errors.
val writev_assume_fd_is_nonblocking : Unix.file_descr -> ?count:int -> t Core__.Core_unix.IOVec.t array -> intwritev_assume_fd_is_nonblocking fd ?count iovecswritescountiovecsof bigstrings to file descriptorfdwithout yielding to other OCaml-threads. Returns the number of bytes actually written.Raises
Invalid_argumentif the designated range is out of bounds. RaisesUnix_errorin the case of output errors.
val recvmmsg_assume_fd_is_nonblocking : (Unix.file_descr -> ?count:int -> ?srcs:Unix.sockaddr array -> t Core__.Core_unix.IOVec.t array -> lens:int array -> int) Core__.Import.Or_error.tval unsafe_recvmmsg_assume_fd_is_nonblocking : (Unix.file_descr -> t Core__.Core_unix.IOVec.t array -> int -> Unix.sockaddr array option -> int array -> int) Core__.Import.Or_error.t
val sendmsg_nonblocking_no_sigpipe : (Unix.file_descr -> ?count:int -> t Core__.Core_unix.IOVec.t array -> int option) Core__.Import.Or_error.tsendmsg_nonblocking_no_sigpipe sock ?count iovecssendscountiovecsof bigstrings to socketsock. ReturnsSome bytes_written, orNoneif the operation would have blocked. This system call will not cause signalSIGPIPEif an attempt is made to write to a socket that was closed by the other side.Raises
Invalid_argumentifcountis out of range. RaisesUnix_errorin the case of output errors.
val output : ?min_len:int -> Core__.Import.Out_channel.t -> ?pos:int -> ?len:int -> t -> intoutput ?min_len oc ?pos ?len bstrtries to outputlenbytes (guarantees to write at leastmin_lenbytes, which must be>= 0), if possible, before returning, from bigstringbstrstarting at positionposto output channeloc. Returns the number of bytes actually written.NOTE: You may need to flush
octo make sure that the data is actually sent.NOTE: If
lencharacters fit into the channel buffer completely, they will be buffered. Otherwise writes will be attempted until at leastmin_lencharacters have been sent.Raises
Invalid_argumentif the designated range is out of bounds.Raises
IOErrorin the case of output errors. TheIOErrorargument counting the number of successful bytes includes those that have been transferred to the channel buffer before the error.
val really_output : Core__.Import.Out_channel.t -> ?pos:int -> ?len:int -> t -> unitreally_output oc ?pos ?len bstroutputs exactlylenbytes from bigstringbstrstarting at positionposto output channeloc.Raises
Invalid_argumentif the designated range is out of bounds.Raises
IOErrorin the case of output errors. TheIOErrorargument counting the number of successful bytes includes those that have been transferred to the channel buffer before the error.
Unsafe functions
val unsafe_read_assume_fd_is_nonblocking : Unix.file_descr -> pos:int -> len:int -> t -> Core__.Syscall_result.Int.tunsafe_read_assume_fd_is_nonblocking fd ~pos ~len bstris similar toBigstring.read_assume_fd_is_nonblocking, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_write : Unix.file_descr -> pos:int -> len:int -> t -> intunsafe_write fd ~pos ~len bstris similar toBigstring.write, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_write_assume_fd_is_nonblocking : Unix.file_descr -> pos:int -> len:int -> t -> intunsafe_write_assume_fd_is_nonblocking fd ~pos ~len bstris similar toBigstring.write_assume_fd_is_nonblocking, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_read : min_len:int -> Unix.file_descr -> pos:int -> len:int -> t -> intunsafe_read ~min_len fd ~pos ~len bstris similar toBigstring.read, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_really_recv : Unix.file_descr -> pos:int -> len:int -> t -> unitunsafe_really_recv sock ~pos ~len bstris similar toBigstring.really_recv, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_really_write : Unix.file_descr -> pos:int -> len:int -> t -> unitunsafe_really_write fd ~pos ~len bstris similar toBigstring.write, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_really_send_no_sigpipe : (Unix.file_descr -> pos:int -> len:int -> t -> unit) Core__.Import.Or_error.tunsafe_really_send_no_sigpipe sock ~pos ~len bstris similar toBigstring.send, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_send_nonblocking_no_sigpipe : (Unix.file_descr -> pos:int -> len:int -> t -> Core__.Syscall_result.Int.t) Core__.Import.Or_error.tunsafe_send_nonblocking_no_sigpipe sock ~pos ~len bstris similar toBigstring.send_nonblocking_no_sigpipe, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_writev : Unix.file_descr -> t Core__.Core_unix.IOVec.t array -> int -> intunsafe_writev fd iovecs countis similar toBigstring.writev, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_sendmsg_nonblocking_no_sigpipe : (Unix.file_descr -> t Core__.Core_unix.IOVec.t array -> int -> int option) Core__.Import.Or_error.tunsafe_sendmsg_nonblocking_no_sigpipe fd iovecs countis similar toBigstring.sendmsg_nonblocking_no_sigpipe, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_input : min_len:int -> Core__.Import.In_channel.t -> pos:int -> len:int -> t -> intunsafe_input ~min_len ic ~pos ~len bstris similar toBigstring.input, but does not perform any bounds checks. Will crash on bounds errors!
val unsafe_output : min_len:int -> Core__.Import.Out_channel.t -> pos:int -> len:int -> t -> intunsafe_output ~min_len oc ~pos ~len bstris similar toBigstring.output, but does not perform any bounds checks. Will crash on bounds errors!
Memory mapping
val map_file : shared:bool -> Unix.file_descr -> int -> tmap_file shared fd nmemory-mapsncharacters of the data associated with descriptorfdto a bigstring. Iffsharedistrue, all changes to the bigstring will be reflected in the file.Users must keep in mind that operations on the resulting bigstring may result in disk operations which block the runtime. This is true for pure OCaml operations (such as
t.{1} <- 1), and for calls toblit. While some I/O operations may release the OCaml lock, users should not expect this to be done for all operations on a bigstring returned frommap_file.