open-i18n/rust-unic

CharProperty: API to get all possible values, if applicable

behnam opened this issue · 4 comments

Some properties, like GeneralCategory and BidiClass, are a flat enum, and having a type function returning all possible values of them can help with writing tests.

For example, having an iterator over GC values can reduce this test to 20 execs of the loop block, not all Unicode code points: https://github.com/behnam/rust-unic/blob/master/unic/ucd/category/tests/coverage_tests.rs

calum commented

I'm interested in this one, if it's not already being worked on.

Just to clarify: as an example, you want a function to return all chars that are GC::MathSymbol. Or, do you want a function to return all chars that are GC.is_letter().

calum commented

I've thought about it a bit more now and you actually want a function which takes a char and returns all the types it fits into? Do you want a different function for BidiClass and GeneralCategory, or one function to return all the possible values from both?

Thanks, @calum, for the interest. The thing is that I filed this issue as a tracker for the feature, which is going to be implemented by the macros @CAD97 and I are working on. We are building tools to auto-generate most of the code that's already manually-generated, so we don't have to maintain the little things, like the feature mentioned here, manually.

There are a couple of other good starter tasks that I recommend. Let me comment there for you.

We have the API in and there's an integration test using it, so we can track the implementation directly in the code.