Dwarf.Buffer
Buffer is a light abstraction over string
and bigstring
, that can allow one to share the same string for different sections without explicit copying.
val create : ?pos:int -> 'a -> 'a t
create ~pos:0
creates a buffer from a data
with_pos buf pos
creates a new buffer that shares data with buf
, but has different starting position
with_off buf off
creates a new buffer that shares data with buf
, but has different starting position equal to pos buf + off
val pos : 'a t -> int
pos buf
starting position
val data : 'a t -> 'a
data pos
actual data.
Note: it doesn't start from pos
, it start from 0