refinement_types/char/
unicode.rs1use crate::char::macros::predicate;
4
5predicate! {
6 Name = Ascii,
7 Check = is_ascii,
8 Doc = "Checks whether the given character is within the ASCII range.",
9 Expected = "ascii character",
10 Code = char::ascii,
11 Error = "Non-ASCII character encountered.",
12 Message = "non-ascii character",
13 Help = "make sure the character is within the ASCII range",
14}
15
16predicate! {
17 Name = Alphabetic,
18 Check = is_alphabetic,
19 Doc = "Checks whether the given character is alphabetic.",
20 Expected = "alphabetic character",
21 Code = char::alphabetic,
22 Error = "Non-alphabetic character encountered.",
23 Message = "non-alphabetic character",
24 Help = "make sure the character is alphabetic",
25}
26
27predicate! {
28 Name = Alphanumeric,
29 Check = is_alphanumeric,
30 Doc = "Checks whether the given character is alphanumeric.",
31 Expected = "alphanumeric character",
32 Code = char::alphanumeric,
33 Error = "Non-alphanumeric character encountered.",
34 Message = "non-alphanumeric character",
35 Help = "make sure the character is alphanumeric",
36}
37
38predicate! {
39 Name = Control,
40 Check = is_control,
41 Doc = "Checks whether the given character is control.",
42 Expected = "control character",
43 Code = char::control,
44 Error = "Non-control character encountered.",
45 Message = "non-control character",
46 Help = "make sure the character is control",
47}
48
49predicate! {
50 Name = Numeric,
51 Check = is_numeric,
52 Doc = "Checks whether the given character is numeric.",
53 Expected = "numeric character",
54 Code = char::numeric,
55 Error = "Non-numeric character encountered.",
56 Message = "non-numeric character",
57 Help = "make sure the character is numeric",
58}
59
60predicate! {
61 Name = Lowercase,
62 Check = is_lowercase,
63 Doc = "Checks whether the given character is lowercase.",
64 Expected = "lowercase character",
65 Code = char::lowercase,
66 Error = "Non-lowercase character encountered.",
67 Message = "non-lowercase character",
68 Help = "make sure the character is lowercase",
69}
70
71predicate! {
72 Name = Uppercase,
73 Check = is_uppercase,
74 Doc = "Checks whether the given character is uppercase.",
75 Expected = "uppercase character",
76 Code = char::uppercase,
77 Error = "Non-uppercase character encountered.",
78 Message = "non-uppercase character",
79 Help = "make sure the character is uppercase",
80}
81
82predicate! {
83 Name = Whitespace,
84 Check = is_whitespace,
85 Doc = "Checks whether the given character is whitespace.",
86 Expected = "whitespace character",
87 Code = char::whitespace,
88 Error = "Non-whitespace character encountered.",
89 Message = "non-whitespace character",
90 Help = "make sure the character is whitespace",
91}