CCByte_bufferByte buffer.
A dynamic vector of bytes that doesn't hide its internal from you. Same use case as Buffer.t but with more power.
type t = {mutable bs : bytes;The backing bytes buffer
*)mutable len : int;Length of the "active" slice in bs. The actual content of the buffer is bs[0]..bs[len-1]. What comes after is undefined garbage.
}The byte buffer. The definition is public since 3.13.1 .
val create : ?cap:int -> unit -> tCreate a new buffer with given initial capacity.
val length : t -> intCurrent length.
val is_empty : t -> boolis_empty b is length b=0
val bytes : t -> bytesAccess the underlying byte buffer. This buffer can change after operations that affect the capacity (e.g. add_char).
val clear : t -> unitclear buf sets buf.len <- 0. This doesn't resize the byte buffer.
val ensure_cap : t -> int -> unitensure_cap self n ensures that capacity self >= n.
val ensure_free : t -> int -> unitensure_free buf n ensures that the free space at the end of the buffer is at least n.
val shrink_to : t -> int -> unitshrink_to buf n reduces length buf to at most n. Does nothing if the length is already <= n.
val add_char : t -> char -> unitPush a character at the end.
val append_bytes : t -> bytes -> unitAdd bytes at the end
val append_subbytes : t -> bytes -> int -> int -> unitAdd byte slice at the end
val append_string : t -> string -> unitAdd string at the end
val append_substring : t -> string -> int -> int -> unitAdd substring at the end
val append_buf : t -> Stdlib.Buffer.t -> unitAdd content of the buffer at the end
val append_seq : t -> char Stdlib.Seq.t -> unitAdds characters from the seq
val get : t -> int -> charGet the char at the given offset
val unsafe_get : t -> int -> charGet the char at the given offset, unsafe (no bound check)
val set : t -> int -> char -> unitSet the char at the given offset
val unsafe_set : t -> int -> char -> unitSet the char at the given offset, unsafe (no bound check)
val to_slice : t -> CCByte_slice.tto_slice buf returns a slice of the current content. The slice shares the same byte array as buf (until buf is resized).
val contents : t -> stringCopy the internal data to a string. Allocates.
val iter : (char -> unit) -> t -> unitIterate on the content
val iteri : (int -> char -> unit) -> t -> unitIterate with index.
val fold_left : ('a -> char -> 'a) -> 'a -> t -> 'aval of_seq : char Stdlib.Seq.t -> tval to_seq : t -> char Stdlib.Seq.t