Commit 1a7d3ba7 authored by Stephane Glondu's avatar Stephane Glondu

Remove unused serializable types

parent 04b2c4b4
Pipeline #66700 passed with stages
in 16 minutes and 54 seconds
...@@ -202,6 +202,7 @@ let compare_b64 a b = ...@@ -202,6 +202,7 @@ let compare_b64 a b =
| false, false -> 0 | false, false -> 0
in loop 0 in loop 0
module SSet = Set.Make(String)
module SMap = Map.Make(String) module SMap = Map.Make(String)
(** Direct random monad *) (** Direct random monad *)
......
...@@ -64,6 +64,7 @@ val save_to : string -> (Bi_outbuf.t -> 'a -> unit) -> 'a -> unit ...@@ -64,6 +64,7 @@ val save_to : string -> (Bi_outbuf.t -> 'a -> unit) -> 'a -> unit
val compare_b64 : string -> string -> int val compare_b64 : string -> string -> int
module SSet : Set.S with type elt = string
module SMap : Map.S with type key = string module SMap : Map.S with type key = string
val bytes_to_sample : Platform.Z.t -> int val bytes_to_sample : Platform.Z.t -> int
......
...@@ -45,35 +45,3 @@ let read_number = make_read "read_number" Z.of_string ...@@ -45,35 +45,3 @@ let read_number = make_read "read_number" Z.of_string
let write_uuid = make_write raw_string_of_uuid let write_uuid = make_write raw_string_of_uuid
let read_uuid = make_read "read_uuid" uuid_of_raw_string let read_uuid = make_read "read_uuid" uuid_of_raw_string
(** {1 Serializers for type int_or_null} *)
let write_int_or_null buf = function
| Some n -> Bi_outbuf.add_string buf (string_of_int n)
| None -> Bi_outbuf.add_string buf "null"
let int_or_null_of_json = function
| `Int i -> Some i
| `Null -> None
| _ -> invalid_arg "int_or_null_of_json: unexpected input"
let read_int_or_null state buf =
int_or_null_of_json (Yojson.Safe.from_lexbuf ~stream:true state buf)
(** {1 Serializers for type string_set} *)
let write_string_set buf set =
`List (SSet.elements set |> List.map (fun x -> `String x)) |>
Yojson.Safe.to_outbuf buf
let string_set_of_json = function
| `List xs ->
List.fold_left (fun accu x ->
match x with
| `String y -> SSet.add y accu
| _ -> invalid_arg "string_set_of_json: a string was expected"
) SSet.empty xs
| _ -> invalid_arg "string_set_of_json: a list was expected"
let read_string_set state buf =
Yojson.Safe.from_lexbuf ~stream:true state buf |> string_set_of_json
...@@ -30,13 +30,3 @@ val read_number : Yojson.Safe.lexer_state -> Lexing.lexbuf -> number ...@@ -30,13 +30,3 @@ val read_number : Yojson.Safe.lexer_state -> Lexing.lexbuf -> number
val write_uuid : Bi_outbuf.t -> uuid -> unit val write_uuid : Bi_outbuf.t -> uuid -> unit
val read_uuid : Yojson.Safe.lexer_state -> Lexing.lexbuf -> uuid val read_uuid : Yojson.Safe.lexer_state -> Lexing.lexbuf -> uuid
(** {1 Serializers for type int_or_null} *)
val write_int_or_null : Bi_outbuf.t -> int_or_null -> unit
val read_int_or_null : Yojson.Safe.lexer_state -> Lexing.lexbuf -> int_or_null
(** {1 Serializers for type string_set} *)
val write_string_set : Bi_outbuf.t -> string_set -> unit
val read_string_set : Yojson.Safe.lexer_state -> Lexing.lexbuf -> string_set
...@@ -23,7 +23,6 @@ open Platform ...@@ -23,7 +23,6 @@ open Platform
type number = Z.t type number = Z.t
type uuid = string type uuid = string
type int_or_null = int option
let digits = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" let digits = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
let min_uuid_length = 14 (* at least 82 bits of entropy *) let min_uuid_length = 14 (* at least 82 bits of entropy *)
...@@ -47,7 +46,3 @@ let uuid_of_raw_string x = ...@@ -47,7 +46,3 @@ let uuid_of_raw_string x =
else Printf.ksprintf invalid_arg "%S is not a valid UUID" x else Printf.ksprintf invalid_arg "%S is not a valid UUID" x
let raw_string_of_uuid x = x let raw_string_of_uuid x = x
module SSet = Set.Make(String)
type string_set = SSet.t
...@@ -23,13 +23,8 @@ open Platform ...@@ -23,13 +23,8 @@ open Platform
type number = Z.t type number = Z.t
type uuid type uuid
type int_or_null = int option
val min_uuid_length : int val min_uuid_length : int
val uuid_of_raw_string : string -> uuid val uuid_of_raw_string : string -> uuid
val raw_string_of_uuid : uuid -> string val raw_string_of_uuid : uuid -> string
module SSet : Set.S with type elt = string
type string_set = SSet.t
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
type number <ocaml predef from="Serializable_builtin"> = abstract type number <ocaml predef from="Serializable_builtin"> = abstract
type uuid <ocaml predef from="Serializable_builtin"> = abstract type uuid <ocaml predef from="Serializable_builtin"> = abstract
type string_set <ocaml predef from="Serializable_builtin"> = abstract
type datetime <ocaml predef from="Web_serializable_builtin"> = abstract type datetime <ocaml predef from="Web_serializable_builtin"> = abstract
type proof <ocaml predef from="Serializable"> = abstract type proof <ocaml predef from="Serializable"> = abstract
type template <ocaml predef from="Serializable"> = abstract type template <ocaml predef from="Serializable"> = abstract
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment