1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Copyright © 2026 Mikhail Hogrefe
//
// This file is part of Malachite.
//
// Malachite is free software: you can redistribute it and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published by the Free Software Foundation; either version
// 3 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>.
use crateToDebugString;
/// Determines whether a [`char`] is graphic.
///
/// There is an [official Unicode
/// definition](https://www.unicode.org/versions/Unicode14.0.0/ch03.pdf#G30602) of _graphic
/// character_, but that definition is not followed here. In Malachite, a [`char`] is considered
/// graphic if it is ASCII and not a [C0 control](https://www.unicode.org/charts/PDF/U0000.pdf), or
/// non-ASCII and its debug string does not begin with a backslash. This function can be used as a
/// guide to whether a [`char`] can be displayed on a screen without resorting to some sort of
/// escape sequence. Of course, many typefaces will not be able to render many graphic [`char`]s.
///
/// The ASCII space `' '` is the only graphic whitespace [`char`].
///
/// # Worst-case complexity
/// Constant time and additional memory.
///
/// # Examples
/// ```
/// use malachite_base::chars::char_is_graphic;
///
/// assert_eq!(char_is_graphic('a'), true);
/// assert_eq!(char_is_graphic(' '), true);
/// assert_eq!(char_is_graphic('\n'), false);
/// assert_eq!(char_is_graphic('ñ'), true);
/// assert_eq!(char_is_graphic('\u{5f771}'), false);
/// ```
/// Constants associated with [`char`]s.
///
/// Apart from the constants visibile on this page, the trait-based constants
/// [`MIN`](crate::comparison::traits::Min::MIN), [`MAX`](crate::comparison::traits::Max::MAX), and
/// [`NAME`](crate::named::Named::NAME) are also defined.
/// Functions for incrementing and decrementing [`char`]s.
/// Iterators that generate [`char`]s without repetition.
/// The implementation of [`ToLatex`](crate::strings::latex::ToLatex) for [`char`].
// The generated `char`-to-LaTeX table that `latex` consults; see the note in that module.
/// Iterators that generate [`char`]s randomly.
/// Functions for writing and reading numbers as runs of Unicode script digits.
/// The implementation of [`ToTypst`](crate::strings::typst::ToTypst) for [`char`].