aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/manual/cowboy_constraints.asciidoc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-09-04 14:33:44 +0200
committerLoïc Hoguin <[email protected]>2017-09-04 14:33:44 +0200
commit58e9e76814a8291894ba01ac8a4551e4f8d480b3 (patch)
tree58145af48e5c9dbcec51ffec14bb9faea25c6b24 /doc/src/manual/cowboy_constraints.asciidoc
parent47aa0097ed3f63bf0de1b540a6a8d4086e3d2ea6 (diff)
downloadcowboy-58e9e76814a8291894ba01ac8a4551e4f8d480b3.tar.gz
cowboy-58e9e76814a8291894ba01ac8a4551e4f8d480b3.tar.bz2
cowboy-58e9e76814a8291894ba01ac8a4551e4f8d480b3.zip
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.
Diffstat (limited to 'doc/src/manual/cowboy_constraints.asciidoc')
-rw-r--r--doc/src/manual/cowboy_constraints.asciidoc60
1 files changed, 60 insertions, 0 deletions
diff --git a/doc/src/manual/cowboy_constraints.asciidoc b/doc/src/manual/cowboy_constraints.asciidoc
new file mode 100644
index 0000000..52ee664
--- /dev/null
+++ b/doc/src/manual/cowboy_constraints.asciidoc
@@ -0,0 +1,60 @@
+= cowboy_constraints(3)
+
+== Name
+
+cowboy_constraints - Constraints
+
+== Description
+
+The module `cowboy_constraints` defines the built-in
+constraints in Cowboy and provides an interface for
+manipulating these constraints.
+
+Constraints are functions that define what type of
+input is allowed. They are used throughout Cowboy,
+from the router to query strings to cookies.
+
+== Exports
+
+Built-in constraints:
+
+* link:man:cowboy_constraints:int(3)[cowboy_constraints:int(3)] - Integer constraint
+* link:man:cowboy_constraints:nonempty(3)[cowboy_constraints:nonempty(3)] - Non-empty constraint
+
+== Types
+
+=== constraint()
+
+[source,erlang]
+----
+constraint() :: int | nonempty | fun()
+----
+
+A constraint function.
+
+The atom constraints are built-in, see the corresponding
+function in the exports list above.
+
+=== reason()
+
+[source,erlang]
+----
+reason() :: {constraint(), Reason, Value}
+
+Reason :: any()
+Value :: any()
+----
+
+Reason for the constraint failure.
+
+It includes the constraint function in question,
+a machine-readable error reason and the value that
+made the constraint fail.
+
+== See also
+
+link:man:cowboy(7)[cowboy(7)],
+link:man:cowboy(3)[cowboy(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)]