-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CharProperty: API to get all possible values, if applicable #66
Comments
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 |
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. |
The `all_values()` static function is a new API for character properties implemented as *flat* `enum` types in Rust, like some of Unicode properties of type *Catalog* or *Enumeration*, to return an exhaustive list of all possible values. The function is useful mainly in writing integration tests, but since is efficient in implementation, can be used in application logic, as well. The current list is manually created and maintained. With migration to `char_property` macros, the list will be auto-generated. (Possibly stored in a private module and only exposed via `all_values()` API.) See <#66>
The `all_values()` static function is a new API for character properties implemented as *flat* `enum` types in Rust, like some of Unicode properties of type *Catalog* or *Enumeration*, to return an exhaustive list of all possible values. The function is useful mainly in writing integration tests, but since is efficient in implementation, can be used in application logic, as well. The current list is manually created and maintained. With migration to `char_property` macros, the list will be auto-generated. (Possibly stored in a private module and only exposed via `all_values()` API.) See <#66>
We have the API in and there's an integration test using it, so we can track the implementation directly in the code. |
Some properties, like
GeneralCategory
andBidiClass
, 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
The text was updated successfully, but these errors were encountered: