package base

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

Source file buffer.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
open! Import
include Buffer_intf
include Caml.Buffer

let contents_bytes = to_bytes
let add_substring t s ~pos ~len = add_substring t s pos len
let add_subbytes t s ~pos ~len = add_subbytes t s pos len
let sexp_of_t t = sexp_of_string (contents t)

module To_bytes =
  Blit.Make_distinct
    (struct
      type nonrec t = t

      let length = length
    end)
    (struct
      type t = Bytes.t

      let create ~len = Bytes.create len
      let length = Bytes.length

      let unsafe_blit ~src ~src_pos ~dst ~dst_pos ~len =
        Caml.Buffer.blit src src_pos dst dst_pos len
      ;;
    end)

include To_bytes
module To_string = Blit.Make_to_string (Caml.Buffer) (To_bytes)
OCaml

Innovation. Community. Security.