package octez-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=c6df840ebbf115e454db949028c595bec558a59a66cade73b52a6d099d6fa4d4
sha512=d8aee903b9fe130d73176bc8ec38b78c9ff65317da3cb4f3415f09af0c625b4384e7498201fdb61aa39086a7d5d409d0ab3423f9bc3ab989a680cf444a79bc13
doc/octez-libs.rpc/Tezos_rpc/Arg/index.html
Module Tezos_rpc.Arg
Source
include module type of struct include Resto.Arg end
The type of an argument.
val make :
?descr:string ->
name:string ->
destruct:(string -> ('a, string) result) ->
construct:('a -> string) ->
unit ->
'a arg
make ?descr ~name ~destruct ~construct ()
is an argument. The values of descr
and name
are used for documentation purpose only. The values of destruct
and construct
are used for conversion from/to string
s. Note that it is expected that destruct
and construct
round-trip (modulo the result
error wrapping).
descr
is a type for the documentation of a t
.
bool
is an argument for boolean values. The strings "yes"
, "y"
, "true"
, and "t"
, as well as all capitalisation variation thereof, all parsed to true
. The strings "no"
, "n"
, "false"
, and "f"
, as well as all capitalisation variation thereof, all parsed to false
. All other strings fail to parse.
int
is an argument for integer values. The parsing is identical to that of Stdlib.int_of_string
-- refer to that function's documentation.
int32
is an argument for 32-bit integer values. The parsing is identical to that of Int32.of_string
-- refer to that function's documentation.
int64
is an argument for 64-bit integer values. The parsing is identical to that of Int64.of_string
-- refer to that function's documentation.
float
is an argument for floating-point decimal values. The parsing is identical to that of Float.of_string
-- refer to that function's documentation.
like a ?descr name
is a new argument which carries the same type parameter and uses the same constructor/destructor functions as a
, but has a different name and description. It is intended to be used to give different meaning to isomorphic arguments. E.g.,
let date = make ~descr:"A date in YYYY-MM-DD format" ~name:"date" ~destruct:(fun s -> ..) ~construct:(fun d -> ..) () in let birth_date = like date ~descr:"A date of birth in the YYYY-MM-DD format" "birth-date" in ..