ocaml http/1, http/2 and websocket client and server library
1(** Reusable plug collections for route groups (Phoenix-style pipelines). *)
2
3type t = Core.t list
4
5let empty : t = []
6let create (plugs : Core.t list) : t = plugs
7let plug (t : t) (p : Core.t) : t = t @ [ p ]
8let plug_first (t : t) (p : Core.t) : t = p :: t
9let compose (t1 : t) (t2 : t) : t = t1 @ t2
10let to_plug (t : t) : Core.t = Core.compose_all t
11
12let apply (t : t) (handler : Core.handler) : Core.handler =
13 Core.apply (to_plug t) handler
14
15let is_empty (t : t) : bool = t = []
16let length (t : t) : int = List.length t