这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Aug 31, 2025. It is now read-only.

Conversation

@FenrirWolf
Copy link
Contributor

The in-tree version of wtf8 has a few extra functions that are used by OsString wrappers, so I figured I'd add them here too. Also fixed the FIXME's.

@SimonSapin
Copy link
Owner

These changes look good, but this repository was originally a proof of concept and I don’t really want to maintain it. If you’d like to take over maintenance I can give you access to https://crates.io/crates/wtf8.

A side note on Ord / PartialOrd: sorting UTF-8 or WTF-8 bytes like this gives the same results as sorting lexicographically by codepoint. This is generally what you want when dealing with Unicode, but it is not the same as sorting [u16] UTF-16 / WTF-16 code units. For that you’d want to use Wtf8::to_ill_formed_utf16 with Iterator::cmp.

Since WTF-8 is designed to deal with WTF-16 systems, obvious which of the two orderings a user of the library might want. And so I think it might be better not to implement the Ord or PartialOrd traits at all. (Instead, maybe provide two fn cmp_codepoints(&self) -> cmp::Ordering and fn cmp_u16_units(&self) -> cmp::Ordering methods.)

(WTF-16 is when "potentially ill-formed UTF-16" is too long: https://simonsapin.github.io/wtf-8/#wtf-16)

@FenrirWolf
Copy link
Contributor Author

Right, I suppose there isn't much reason to actively maintain this repo when the main consumer of WTF8 already has an internal copy of it. I might just go the same route and copy the in-tree version into my own library. I don't imagine there are very many people out there with a use-case similar to mine anyway.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants