package containers

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module CCByte_bufferSource

Byte buffer.

A dynamic vector of bytes.

  • since 3.7
Sourcetype t
Sourcetype 'a iter = ('a -> unit) -> unit
Sourceval create : ?cap:int -> unit -> t

Create a new buffer with given initial capacity.

Sourceval length : t -> int

Current length.

Sourceval is_empty : t -> bool

is_empty b is length b=0

Sourceval capacity : t -> int

Current capacity (size of the array returned by bytes)

Sourceval bytes : t -> bytes

Access the underlying byte buffer. This buffer can change after operations that affect the capacity (e.g. add_char).

Sourceval clear : t -> unit
Sourceval ensure_cap : t -> int -> unit

ensure_cap self n ensures that capacity self >= n.

Sourceval shrink_to : t -> int -> unit

shrink_to buf n reduces length buf to at most n. Does nothing if the length is already <= n.

Sourceval add_char : t -> char -> unit

Push a character at the end.

Sourceval append_bytes : t -> bytes -> unit
Sourceval append_subbytes : t -> bytes -> int -> int -> unit
Sourceval append_string : t -> string -> unit
Sourceval append_substring : t -> string -> int -> int -> unit
Sourceval append_buf : t -> Buffer.t -> unit
Sourceval append_iter : t -> char iter -> unit
Sourceval append_seq : t -> char Seq.t -> unit
Sourceval get : t -> int -> char
Sourceval unsafe_get : t -> int -> char
Sourceval set : t -> int -> char -> unit
Sourceval unsafe_set : t -> int -> char -> unit
Sourceval contents : t -> string

Copy the internal data to a string

Sourceval contents_bytes : t -> bytes

Copy the internal data to a byte buffer

Sourceval iter : (char -> unit) -> t -> unit
Sourceval fold_left : ('a -> char -> 'a) -> 'a -> t -> 'a
Sourceval of_iter : char iter -> t
Sourceval of_seq : char Seq.t -> t
Sourceval to_iter : t -> char iter
Sourceval to_seq : t -> char Seq.t
OCaml

Innovation. Community. Security.