rust-lang/rust — pull request #18603 by brson (2014-11-04 01:59:59+00:00)
Title: Some stabilization and conventions changes to std::char

* 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. 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.