package resp

  1. Overview
  2. Docs
Redis serialization protocol library

Install

dune-project
 Dependency

Authors

Maintainers

Sources

resp-0.11.0.tbz
sha256=8c4f7afbed08c5d373a822cf0d2f21427605a283b24ef2e1354aa4bff3dd5035
sha512=1a14349721871c532142d48ad2811d8aad48173fe3c9a4eb0de7df3bcc58fedf98ed62ab0b548d9fa0d97c99559fb63de17622414155017744d04b8d8a35ff79

doc/src/resp/resp_intf.ml.html

Source file resp_intf.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
type t =
  | Nil
  | Integer of int64
  | Simple_string of string
  | Error of string
  | Bulk of [ `String of string | `Bytes of bytes ]
  | Array of t Seq.t

type lexeme =
  [ `Nil
  | `Integer of int64
  | `Simple_string of string
  | `Error of string
  | `Bs of int
  | `As of int ]

type error =
  [ `Msg of string | `Unexpected of char | `Invalid_value | `Invalid_encoder ]

module type Resp = sig
  type t =
    | Nil
    | Integer of int64
    | Simple_string of string
    | Error of string
    | Bulk of [ `String of string | `Bytes of bytes ]
    | Array of t Seq.t

  type lexeme =
    [ `Nil
    | `Integer of int64
    | `Simple_string of string
    | `Error of string
    | `Bs of int
    | `As of int ]

  type error =
    [ `Msg of string | `Unexpected of char | `Invalid_value | `Invalid_encoder ]

  val pp_error : Format.formatter -> error -> unit

  val string_of_error : error -> string

  val unwrap : ('a, error) result -> 'a

  exception Exc of error

  module type INPUT = sig
    type ic

    val read : ic -> int -> string Lwt.t

    val read_line : ic -> string Lwt.t

    val read_char : ic -> char Lwt.t
  end

  module type OUTPUT = sig
    type oc

    val write : oc -> string -> unit Lwt.t
  end

  module type READER = sig
    include INPUT

    val read_lexeme : ic -> (lexeme, error) result Lwt.t

    val decode : ic -> lexeme -> t Lwt.t
  end

  module type WRITER = sig
    include OUTPUT

    val write_sep : oc -> unit Lwt.t

    val write_lexeme : oc -> lexeme -> unit Lwt.t

    val encode : oc -> t -> unit Lwt.t
  end

  module type S = sig
    module Reader : READER

    module Writer : WRITER

    val write : Writer.oc -> t -> unit Lwt.t

    val read : Reader.ic -> t Lwt.t
  end

  module Reader (I : INPUT) : READER with type ic = I.ic

  module Writer (O : OUTPUT) : WRITER with type oc = O.oc

  module Make (Reader : READER) (Writer : WRITER) :
    S with module Reader = Reader and module Writer = Writer

  module String_reader : READER with type ic = string ref

  module String_writer : WRITER with type oc = string ref

  module String :
    S with module Reader = String_reader and module Writer = String_writer

  val is_nil : t -> bool

  val to_string : t -> (string, error) result

  val to_string_exn : t -> string

  val to_bytes : t -> (bytes, error) result

  val to_bytes_exn : t -> bytes

  val to_integer : t -> (int64, error) result

  val to_integer_exn : t -> int64

  val to_float : t -> (float, error) result

  val to_float_exn : t -> float

  val to_array : (t -> 'b) -> t -> ('b array, error) result

  val to_array_exn : (t -> 'b) -> t -> 'b array

  val to_list : (t -> 'b) -> t -> ('b list, error) result

  val to_list_exn : (t -> 'b) -> t -> 'b list

  val to_seq : (t -> 'b) -> t -> ('b Seq.t, error) result

  val to_seq_exn : (t -> 'b) -> t -> 'b Seq.t

  val to_alist : (t -> 'k) -> (t -> 'v) -> t -> (('k * 'v) list, error) result

  val to_alist_exn : (t -> 'k) -> (t -> 'v) -> t -> ('k * 'v) list

  val to_hashtbl :
    (t -> 'k) -> (t -> 'v) -> t -> (('k, 'v) Hashtbl.t, error) result

  val to_hashtbl_exn : (t -> 'k) -> (t -> 'v) -> t -> ('k, 'v) Hashtbl.t

  val int : int -> t

  val int64 : int64 -> t

  val float : float -> t

  val bytes : bytes -> t

  val string : string -> t

  val simple_string : string -> t

  val nil : t

  val array : ('a -> t) -> 'a array -> t

  val list : ('a -> t) -> 'a list -> t

  val alist : ('k -> t) -> ('v -> t) -> ('k * 'v) list -> t

  val hashtbl : ('k -> t) -> ('v -> t) -> ('k, 'v) Hashtbl.t -> t

  val id : 'a -> 'a

  val equal : t -> t -> bool
end
OCaml

Innovation. Community. Security.