Source file bigbuffer_internal.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
open! Import
type t =
{ mutable bstr : Bigstring.t
; mutable pos : int
; mutable len : int
; init : Bigstring.t
}
[@@deriving sexp_of]
let resize buf more =
let min_len = buf.len + more in
let new_len = min_len + min_len in
let new_buf = Bigstring.create new_len in
Bigstring.blito ~src:buf.bstr ~src_len:buf.pos ~dst:new_buf ();
buf.bstr <- new_buf;
buf.len <- new_len
;;