Debian Codegraph @

doc/src/manual/cowboy_constraints.nonempty.asciidoc

raw
1 = cowboy_constraints:nonempty(3)
2
3 == Name
4
5 cowboy_constraints:nonempty - Non-empty constraint
6
7 == Description
8
9 Constraint functions implement a number of different operations.
10
11 [source,erlang]
12 ----
13 nonempty(forward | reverse, <<>>) -> {error, empty}
14 ----
15
16 Reject empty values.
17
18 [source,erlang]
19 ----
20 nonempty(forward | reverse, Bin) -> {ok, Bin}
21
22 Bin :: binary()
23 ----
24
25 Accept any other binary values.
26
27 [source,erlang]
28 ----
29 nonempty(format_error, Error) -> HumanReadable
30
31 Error :: {empty, Bin}
32 HumanReadable :: iolist()
33 ----
34
35 Generate a human-readable error message.
36
37 == Arguments
38
39 Arguments vary depending on the operation. Constraint
40 functions always take the operation type as first argument,
41 and the value as second argument.
42
43 == Return value
44
45 The return value varies depending on the operation.
46
47 == Changelog
48
49 * *2.0*: Interface modified to allow for a variety of operations.
50 * *1.0*: Constraint introduced.
51
52 == Examples
53
54 This function is not meant to be called directly.
55
56 == See also
57
58 link:man:cowboy_constraints(3)[cowboy_constraints(3)],
59 link:man:cowboy_constraints:int(3)[cowboy_constraints:int(3)],
60 link:man:cowboy_constraints:from_fun(3)[cowboy_constraints:from_fun(3)],
61 link:man:cowboy_router(3)[cowboy_router(3)],
62 link:man:cowboy_req:match_cookies(3)[cowboy_req:match_cookies(3)],
63 link:man:cowboy_req:match_qs(3)[cowboy_req:match_qs(3)]