package git

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

Module Git.BufferSource

An implementation of the Buffer module but with Cstruct.t.

Sourcetype t

The abstract type of buffers.

Sourcetype raw = string

The type of result.

Sourcetype fixe = Cstruct.t

The type of input.

Sourceval create : int -> t

create n returns a fresh buffer, initially empty. The n parameter is the initial size of the internal byte sequence that holds the buffer contents. That byte sequence is automatically reallocated when more than n bytes are stored in the buffer, but shrinks back to n bytes when reset is called.

For best performance, n should be of the same order of magnitude as the number of characters that are expected to be stored in the buffer. Nothing bad will happen if the buffer grows beyond that limit, however.

Sourceval contents : t -> raw

Return a copy of the current contents of the buffer. The buffer itself is unchanged.

Sourceval unsafe_contents : t -> fixe
Sourceval has : t -> int
Sourceval add : t -> fixe -> unit

add fixe buffer appends the fixed-size buffer fixe at the end of the buffer buffer.

Sourceval clear : t -> unit

Empty the buffer.

Sourceval reset : t -> unit

Empty the buffer and de-allocate the internal byte sequence internal byte sequence of length n that was allocated by Buffer.create n. For long-lived buffers that may have grown a lot, reset allows faster reclamation of the space used by the buffer.

OCaml

Innovation. Community. Security.