From 58e9e76814a8291894ba01ac8a4551e4f8d480b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 4 Sep 2017 14:33:44 +0200 Subject: Fix more documentation todos I have decided not to include a manual page for cowboy_stream_h at this point because it clashes with the cowboy_stream manual page. This decision will be revisited in the future. --- doc/src/manual/cowboy_constraints.int.asciidoc | 63 ++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 doc/src/manual/cowboy_constraints.int.asciidoc (limited to 'doc/src/manual/cowboy_constraints.int.asciidoc') diff --git a/doc/src/manual/cowboy_constraints.int.asciidoc b/doc/src/manual/cowboy_constraints.int.asciidoc new file mode 100644 index 0000000..28855a4 --- /dev/null +++ b/doc/src/manual/cowboy_constraints.int.asciidoc @@ -0,0 +1,63 @@ += cowboy_constraints:int(3) + +== Name + +cowboy_constraints:int - Integer constraint + +== Description + +Constraint functions implement a number of different operations. + +[source,erlang] +---- +int(forward, Bin) -> {ok, Int} | {error, not_an_integer} + +Bin :: binary() +Int :: integer() +---- + +Validate and convert the text representation of an integer. + +[source,erlang] +---- +int(reverse, Int) -> {ok, Bin} | {error, not_an_integer} +---- + +Convert an integer back to its text representation. + +[source,erlang] +---- +int(format_error, Error) -> HumanReadable + +Error :: {not_an_integer, Bin | Int} +HumanReadable :: iolist() +---- + +Generate a human-readable error message. + +== Arguments + +Arguments vary depending on the operation. Constraint +functions always take the operation type as first argument, +and the value as second argument. + +== Return value + +The return value varies depending on the operation. + +== Changelog + +* *2.0*: Interface modified to allow for a variety of operations. +* *1.0*: Constraint introduced. + +== Examples + +This function is not meant to be called directly. + +== See also + +link:man:cowboy_constraints(3)[cowboy_constraints(3)], +link:man:cowboy_constraints:nonempty(3)[cowboy_constraints:nonempty(3)], +link:man:cowboy_router(3)[cowboy_router(3)], +link:man:cowboy_req:match_cookies(3)[cowboy_req:match_cookies(3)], +link:man:cowboy_req:match_qs(3)[cowboy_req:match_qs(3)] -- cgit v1.2.3