package iostream

  1. Overview
  2. Docs

Source file iostream_types.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
module Slice = struct
  type t = {
    bytes: bytes;  (** Bytes *)
    mutable off: int;  (** Offset in bytes *)
    mutable len: int;  (** Length of the slice. Empty slice has [len=0] *)
  }
end

module Seekable = struct
  class type t = object
    method seek : int -> unit
    method pos : unit -> int
  end
end

module In = struct
  class type t = object
    method input : bytes -> int -> int -> int
    (** Read into the slice. Returns [0] only if the
        stream is closed. *)

    method close : unit -> unit
    (** Close the input. Must be idempotent. *)
  end

  class type t_seekable = object
    inherit t
    inherit Seekable.t
  end
end

module In_buf = struct
  class type t = object
    inherit In.t
    method fill_buf : unit -> Slice.t
    method consume : int -> unit
  end
end

module Out = struct
  class type t = object
    method output : bytes -> int -> int -> unit
    method close : unit -> unit
  end

  class type t_seekable = object
    inherit t
    inherit Seekable.t
  end
end

module Out_buf = struct
  class type t = object
    method output_char : char -> unit
    method output : bytes -> int -> int -> unit
    method flush : unit -> unit
    method close : unit -> unit
  end

  class type t_seekable = object
    inherit t
    inherit Seekable.t
  end
end
OCaml

Innovation. Community. Security.