package vif

  1. Overview
  2. Docs

Module Vif_core.RouteSource

Sourceval src : Logs.src
Sourcemodule Ext : sig ... end
Sourcemodule Utils : sig ... end
Sourceval sort_query : (string * 'a) list -> (string * 'a) list
Sourcetype 'a re_atom
Sourceval re_atom : int -> ('a, 'b) Tyre.Internal.raw -> int * 'b Tyre.Internal.wit * Re.t

Top level atoms are specialized for path and query, see documentation.

Sourceval re_atom_path : 'e 'a. int -> ('e, 'a) Tyre.Internal.raw -> int * 'a re_atom * Re.t list
Sourceval re_atom_query : 'e 'a. int -> ('e, 'a) Tyre.Internal.raw -> int * 'a re_atom * Re.t
Sourcetype (_, _) re_path =
  1. | Start : ('r, 'r) re_path
  2. | PathAtom : ('f, 'a -> 'r) re_path * 'a re_atom -> ('f, 'r) re_path
Sourceval re_path : 'e 'r 'f. int -> ('e, 'f, 'r) Vif_core__.Vif_uri.path -> int * ('f, 'r) re_path * Re.t list
Sourcetype ('fu, 'ret) re_query =
  1. | Nil : ('r, 'r) re_query
  2. | Any : ('r, 'r) re_query
  3. | Cons : 'a re_atom * ('f, 'r) re_query -> ('a -> 'f, 'r) re_query
Sourceval collect_re_query : 'e 'r 'f. ('e, 'f, 'r) Vif_core__.Vif_uri.query -> int * ('f, 'r) re_query * bool * (string * (Re.t * int)) list
Sourceval shift_lits : 'a. int -> 'a re_atom -> 'a re_atom
Sourceval permut_query : 'r 'f. int -> int array -> ('r, 'f) re_query -> ('r, 'f) re_query
Sourceval re_query : int -> ('a, 'b, 'c) Vif_core__.Vif_uri.query -> int * ('b, 'c) re_query * bool * (string * (Re.t * int)) list
Sourcetype ('f, 'r) re_url =
  1. | ReUrl : ('f, 'x) re_path * ('x, 'r) re_query -> ('f, 'r) re_url
Sourceval re_url : 'e 'f 'r. int -> ('e, 'f, 'r) Vif_core__.Vif_uri.t -> int * ('f, 'r) re_url * Re.t
Sourceval get_re : ('a, 'b, 'c) Vif_core__.Vif_uri.t -> Re.t

Extraction.

Sourceexception Tyre_exn of exn
Sourceval extract_atom : original:string -> 'a Tyre.Internal.wit -> Re.Group.t -> 'a

Extracting atom is just a matter of following the witness. We just need to take care of counting where we are in the matching groups.

Sourceval extract_path : 'f 'x 'r. original:string -> ('f, 'x) re_path -> Re.Group.t -> ('x -> 'r) -> 'f -> 'r

Since path is in reversed order, we proceed by continuation.

Sourceval extract_query : 'x 'r. original:string -> ('x, 'r) re_query -> Re.Group.t -> 'x -> 'r

Query are in the right order, we can proceed in direct style.

Sourceval extract_url : 'r 'f. original:string -> ('f, 'r) re_url -> Re.Group.t -> 'f -> 'r
Sourceval extract : ('a, 'b, 'c) Vif_core__.Vif_uri.t -> f:'b -> Uri.t -> 'c
Multiple match
Sourcetype ('socket, 'fu, 'return) req =
  1. | Request : [ `CONNECT | `DELETE | `GET | `HEAD | `OPTIONS | `POST | `PUT | `TRACE | `Other of string ] option * ('c, 'a) Vif_core__.Vif_type.t -> ('socket, ('socket, 'c, 'a) Vif_core__.Vif_request.t -> 'r, 'r) req
Sourcetype ('socket, 'r) t =
  1. | Route : ('socket, 'f, 'x) req * ('e, 'x, 'r) Vif_core__.Vif_uri.t * 'f -> ('socket, 'r) t
Sourceval route : ('a, 'b, 'c) req -> ('d, 'c, 'e) Vif_core__.Vif_uri.t -> 'b -> ('a, 'e) t
Sourcetype ('socket, 'r) re_ex =
  1. | ReEx : ('socket, 'f, 'x) req * 'f * Re.Mark.t * ('x, 'r) re_url -> ('socket, 'r) re_ex
Sourceval build_info_list : ([ `CONNECT | `DELETE | `GET | `HEAD | `OPTIONS | `POST | `PUT | `TRACE | `Other of string ] option -> bool) -> ('a, 'b) t list -> Re.re * ('a, 'b) re_ex list
Sourceval build_info : 's 'r. ('s, 'r) t list -> (Re.re * ('s, 'r) re_ex list) Vif_core__.Vif_method.Map.t * (Re.re * ('s, 'r) re_ex list)
Sourcetype 'socket request = {
  1. extract : 'c 'a. [ `CONNECT | `DELETE | `GET | `HEAD | `OPTIONS | `POST | `PUT | `TRACE | `Other of string ] option -> ('c, 'a) Vif_core__.Vif_type.t -> ('socket, 'c, 'a) Vif_core__.Vif_request.t option;
}
Sourceval prepare_uri : Uri.t -> string
Sourceval find_and_trigger : 's 'r. original:string -> 's request -> Re.Group.t -> ('s, 'r) re_ex list -> 'r
Sourceval match_ : ((Re.re * 'a) Vif_core__.Vif_method.Map.t * (Re.re * 'a)) -> [ `CONNECT | `DELETE | `GET | `HEAD | `OPTIONS | `POST | `PUT | `TRACE | `Other of string ] -> string -> (Re.Group.t * 'a) option
Sourceval dispatch : 's 'r 'c. default:(('s, 'c, string) Vif_core__.Vif_request.t -> string -> 'r) -> ('s, 'r) t list -> meth: [ `CONNECT | `DELETE | `GET | `HEAD | `OPTIONS | `POST | `PUT | `TRACE | `Other of string ] -> request:'s request -> target:string -> 'r