Skip to content
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

Add all missing properties FFI APIs #6177

Merged
merged 11 commits into from
Feb 24, 2025

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented Feb 21, 2025

Part of #6169

Adds:

  • rust_link for to/from ICU4X APIs. Rename them a bit. I am not renaming them to have icu4c in their name because in the context of ICU4X FFI the property integers are not just useful for ICU4X: they're useful for CodePointMapData (which does not return typed values)
  • for_char convenience APIs over FFI, providing a no-alloc way to get properties
  • long_name and short_name APIs, only in compiled data mode. We can add a separate data loading path if requested
  • Bidi convenience properties, only in compiled data mode. We can add a separate data path if requested, again.

@Manishearth Manishearth requested a review from a team as a code owner February 21, 2025 19:11
@Manishearth Manishearth changed the title Fix up icu4c_value and for_char missing APIs Add all missing properties FFI APIs Feb 21, 2025
}
#[diplomat::rust_link(icu::properties::props::BidiClass::to_icu4c_value, FnInStruct)]
/// Convert to an integer value usable with ICU4C and CodePointMapData
pub fn to_integer_value(self) -> u8 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use the same names?

Suggested change
pub fn to_integer_value(self) -> u8 {
pub fn to_icu4c_value(self) -> u8 {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I explained why in the PR body:

I am not renaming them to have icu4c in their name because in the context of ICU4X FFI the property integers are not just useful for ICU4X: they're useful for CodePointMapData (which does not return typed values)

pub fn from_integer(other: u8) -> Option<Self> {
#[diplomat::rust_link(icu::properties::props::BidiClass::from_icu4c_value, FnInStruct)]
/// Convert from an integer value from ICU4C or CodePointMapData
pub fn from_integer_value(other: u8) -> Option<Self> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub fn from_integer_value(other: u8) -> Option<Self> {
pub fn from_icu4c_value(other: u8) -> Option<Self> {

robertbastian
robertbastian previously approved these changes Feb 24, 2025
@Manishearth
Copy link
Member Author

Hm, we're going to have a bit of a conflicty time with all these FFI PRs. Oh well.

@Manishearth Manishearth merged commit 0faaaac into unicode-org:main Feb 24, 2025
28 checks passed
@Manishearth Manishearth deleted the props-ffi-1 branch February 24, 2025 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants