Commit 81eeec0
committed
auto merge of #18603 : brson/rust/stdchar, r=aturon
* Deprecate the free functions in favor of methods, except the two ctors `from_u32` and `from_digit`, whose methods are deprecated.
* Mark the `Char` and `UnicodeChar` traits experimental until we decide for sure that we won't have some sort of inherent methods for primitives.
* The `UnicodeChar` methods related to numerics are now called e.g. `is_numeric` to match the 'numeric' unicode character class, and the `*_digit_radix` methods on `Char` now just called `*_digit`.
* `len_utf8_bytes` -> `len_utf8`
* Converted methods to take self by-value
* Converted `escape_default` and `escape_unicode` to iterators over chars.
* Renamed `is_XID_start`, `is_XID_continue` to `is_xid_start`, `is_xid_continue` to match conventions
This also converts `encode_utf8` and `encode_utf16` to return iterators. I suspect this is not the final form of these methods. Perf is worse (numbers in the commit). Many of the uses ended up being awkward, copying into a buffer then writing that buffer to a `Writer`. It might be more appropriate for these to return `Reader`s instead, but that type is defined in `std`.
Note: although I *did* add the `from_u32` ctor to the `Char` trait, I deprecated it again later, preferring the free ctors.
I've been sitting on this for a while.
cc @aturonFile tree
20 files changed
+379
-171
lines changed- src
- compiletest
- libcollections
- libcoretest
- libcore
- fmt
- libfmt_macros
- libgetopts
- libgraphviz
- librustc_trans/back
- librustc/lint
- librustdoc
- clean
- libstd
- num
- rt
- libsyntax
- parse/lexer
- print
- libterm/terminfo
- libunicode
20 files changed
+379
-171
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1566 | 1566 | | |
1567 | 1567 | | |
1568 | 1568 | | |
1569 | | - | |
| 1569 | + | |
1570 | 1570 | | |
1571 | 1571 | | |
1572 | 1572 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
630 | 630 | | |
631 | 631 | | |
632 | 632 | | |
633 | | - | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
634 | 636 | | |
635 | 637 | | |
636 | 638 | | |
| |||
640 | 642 | | |
641 | 643 | | |
642 | 644 | | |
643 | | - | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
644 | 648 | | |
645 | 649 | | |
646 | 650 | | |
| |||
1189 | 1193 | | |
1190 | 1194 | | |
1191 | 1195 | | |
1192 | | - | |
| 1196 | + | |
1193 | 1197 | | |
1194 | 1198 | | |
1195 | 1199 | | |
| |||
1204 | 1208 | | |
1205 | 1209 | | |
1206 | 1210 | | |
1207 | | - | |
| 1211 | + | |
1208 | 1212 | | |
1209 | 1213 | | |
1210 | 1214 | | |
| |||
1219 | 1223 | | |
1220 | 1224 | | |
1221 | 1225 | | |
1222 | | - | |
| 1226 | + | |
1223 | 1227 | | |
1224 | 1228 | | |
1225 | 1229 | | |
| |||
0 commit comments