Implement `TryFrom<char>` for `u8` by ids1024 · Pull Request #84640 · rust...

 1 year ago
source link: https://github.com/rust-lang/rust/pull/84640
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link


SimonSapin commented on Apr 28, 2021

I would have preferred if we didn’t expose conversions between bytes and Unicode through generic conversion traits that do not make the choice of character encoding visible. However since we already have that same conversion the other way around, at this point that’s not a reason not to add this one.

Still, please expand the doc-comment to discuss encodings like https://doc.rust-lang.org/std/primitive.char.html#impl-From%3Cu8%3E does. In fact that can be mostly copy-pasted, with things like "encode" instead of "decode".

Also please have the docs on the impl rather than only the method. Some rustdoc views fold/hide the latter.

About Joyk

Aggregate valuable and interesting links.
Joyk means Joy of geeK