-
Notifications
You must be signed in to change notification settings - Fork 182
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
Ergonomic compiled data APIs for property types #6049
Comments
Approval requested from |
We should have name getters for both the property and the property value, yes? |
Fine with
The property name? Like |
Yeah. If we don't have it now, we should plan for it in the function names. It's probably fine to have it code-driven instead of data-driven, since the set of properties we support is code-driven. |
I imagine if we ever get this it will be on a new enum. We actually had such an enum in my initial design of the enum props but we moved away from it. I think the current proposed names are compatible with this. |
Discussed
Proposal:
|
See discussion #6048
We have a bunch of APIs for properties that go indirectly through CodePointSetData/etc. It would make sense from a convenience and discoverability point of view to have these also live on the property types. It's certainly how regular Rust users will expect this crate to work. I also think putting data loading front and center is far less important for most "singleton" APIs.
Concrete proposal. We add the following APIs to all types in
icu_provider::props
, duplicated on thePropertyEnum::for_char(ch)
/PropertyEnum::for_u32(ch)
PropertyEnum::long_name()
/PropertyEnum::short_name()
BinaryPropertyUnitStruct
? Maybe?PropertyEnum::try_from_str_strict(&str)
ORPropertyEnum::try_from_str_loose(&str)
(I'd like to just add one, not both, if possible. Perhaps we should pick loose?)@sffc seems to be on board provided that we do not add FromStr/etc impls and clearly document that these are
compiled_data
only.This might be necessary for ICU4X in Bionic: the current APIs are inefficient over FFI (see #6050 for the broader issue)
@robertbastian @zbraniecki thoughts?
The text was updated successfully, but these errors were encountered: