2 unstable releases
new 0.2.0 | Apr 15, 2025 |
---|---|
0.1.0 | Oct 26, 2024 |
#1015 in Data structures
59 downloads per month
53KB
945 lines
A UTF-8 encoded [prim@char
].
This alternate representation of a char
allows for certain benefits:
- Deref to
&str
- Hash/Eq/Ord like
&str
- Smaller than
&'static str
for single codepoint cases (full const support included) - Some
char
methods are implementable without the performance loss of&str
->char
->&str
(for instance in astr::chars()
loop)
To get started, create a Utf8Char
.
utf8char
A char encoded as UTF-8, this has multiple advantages over the char primitive and a one codepoint &str.
Encoding and decoding char<->utf8 is expensive, yet common in cases where
the advantages of the char data representation may not matter (see: str::chars() -> transform -> collect::<String>()
).