Skip to content

Commit

Permalink
Rename to to/from_icu4c_value
Browse files Browse the repository at this point in the history
They can be re-renamed when unicode-org#6067 is fixed, if desired.
  • Loading branch information
Manishearth committed Feb 21, 2025
1 parent e1d5aad commit f66747f
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions ffi/capi/src/properties_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ pub mod ffi {

impl BidiClass {
#[diplomat::rust_link(icu::properties::props::BidiClass::to_icu4c_value, FnInStruct)]
pub fn to_integer(self) -> u8 {
pub fn to_icu4c_value(self) -> u8 {
self as u8
}
#[diplomat::rust_link(icu::properties::props::BidiClass::from_icu4c_value, FnInStruct)]
pub fn from_integer(other: u8) -> Option<Self> {
pub fn from_icu4c_value(other: u8) -> Option<Self> {
Some(match other {
0 => Self::LeftToRight,
1 => Self::RightToLeft,
Expand Down Expand Up @@ -444,11 +444,11 @@ pub mod ffi {

impl Script {
#[diplomat::rust_link(icu::properties::props::Script::to_icu4c_value, FnInStruct)]
pub fn to_integer(self) -> u16 {
pub fn to_icu4c_value(self) -> u16 {
self as u16
}
#[diplomat::rust_link(icu::properties::props::Script::from_icu4c_value, FnInStruct)]
pub fn from_integer(other: u16) -> Option<Self> {
pub fn from_icu4c_value(other: u16) -> Option<Self> {
Some(match other {
167 => Self::Adlam,
161 => Self::Ahom,
Expand Down Expand Up @@ -654,14 +654,14 @@ pub mod ffi {

impl HangulSyllableType {
#[diplomat::rust_link(icu::properties::props::HangulSyllableType::to_icu4c_value, FnInStruct)]
pub fn to_integer(self) -> u8 {
pub fn to_icu4c_value(self) -> u8 {
self as u8
}
#[diplomat::rust_link(
icu::properties::props::HangulSyllableType::from_icu4c_value,
FnInStruct
)]
pub fn from_integer(other: u8) -> Option<Self> {
pub fn from_icu4c_value(other: u8) -> Option<Self> {
Some(match other {
0 => Self::NotApplicable,
1 => Self::LeadingJamo,
Expand Down Expand Up @@ -693,11 +693,11 @@ pub mod ffi {

impl EastAsianWidth {
#[diplomat::rust_link(icu::properties::props::EastAsianWidth::to_icu4c_value, FnInStruct)]
pub fn to_integer(self) -> u8 {
pub fn to_icu4c_value(self) -> u8 {
self as u8
}
#[diplomat::rust_link(icu::properties::props::EastAsianWidth::from_icu4c_value, FnInStruct)]
pub fn from_integer(other: u8) -> Option<Self> {
pub fn from_icu4c_value(other: u8) -> Option<Self> {
Some(match other {
0 => Self::Neutral,
1 => Self::Ambiguous,
Expand Down Expand Up @@ -813,11 +813,11 @@ pub mod ffi {

impl LineBreak {
#[diplomat::rust_link(icu::properties::props::LineBreak::to_icu4c_value, FnInStruct)]
pub fn to_integer(self) -> u8 {
pub fn to_icu4c_value(self) -> u8 {
self as u8
}
#[diplomat::rust_link(icu::properties::props::LineBreak::from_icu4c_value, FnInStruct)]
pub fn from_integer(other: u8) -> Option<Self> {
pub fn from_icu4c_value(other: u8) -> Option<Self> {
Some(match other {
0 => Self::Unknown,
1 => Self::Ambiguous,
Expand Down Expand Up @@ -918,14 +918,14 @@ pub mod ffi {
icu::properties::props::GraphemeClusterBreak::to_icu4c_value,
FnInStruct
)]
pub fn to_integer(self) -> u8 {
pub fn to_icu4c_value(self) -> u8 {
self as u8
}
#[diplomat::rust_link(
icu::properties::props::GraphemeClusterBreak::from_icu4c_value,
FnInStruct
)]
pub fn from_integer(other: u8) -> Option<Self> {
pub fn from_icu4c_value(other: u8) -> Option<Self> {
Some(match other {
0 => Self::Other,
1 => Self::Control,
Expand Down Expand Up @@ -1003,11 +1003,11 @@ pub mod ffi {

impl WordBreak {
#[diplomat::rust_link(icu::properties::props::WordBreak::to_icu4c_value, FnInStruct)]
pub fn to_integer(self) -> u8 {
pub fn to_icu4c_value(self) -> u8 {
self as u8
}
#[diplomat::rust_link(icu::properties::props::WordBreak::from_icu4c_value, FnInStruct)]
pub fn from_integer(other: u8) -> Option<Self> {
pub fn from_icu4c_value(other: u8) -> Option<Self> {
Some(match other {
0 => Self::Other,
1 => Self::ALetter,
Expand Down Expand Up @@ -1074,11 +1074,11 @@ pub mod ffi {

impl SentenceBreak {
#[diplomat::rust_link(icu::properties::props::SentenceBreak::to_icu4c_value, FnInStruct)]
pub fn to_integer(self) -> u8 {
pub fn to_icu4c_value(self) -> u8 {
self as u8
}
#[diplomat::rust_link(icu::properties::props::SentenceBreak::from_icu4c_value, FnInStruct)]
pub fn from_integer(other: u8) -> Option<Self> {
pub fn from_icu4c_value(other: u8) -> Option<Self> {
Some(match other {
0 => Self::Other,
1 => Self::ATerm,
Expand Down Expand Up @@ -1298,14 +1298,14 @@ pub mod ffi {
icu::properties::props::CanonicalCombiningClass::to_icu4c_value,
FnInStruct
)]
pub fn to_integer(self) -> u8 {
pub fn to_icu4c_value(self) -> u8 {
self as u8
}
#[diplomat::rust_link(
icu::properties::props::CanonicalCombiningClass::from_icu4c_value,
FnInStruct
)]
pub fn from_integer(other: u8) -> Option<Self> {
pub fn from_icu4c_value(other: u8) -> Option<Self> {
Some(match other {
0 => Self::NotReordered,
1 => Self::Overlay,
Expand Down Expand Up @@ -1541,14 +1541,14 @@ pub mod ffi {
icu::properties::props::IndicSyllabicCategory::to_icu4c_value,
FnInStruct
)]
pub fn to_integer(self) -> u8 {
pub fn to_icu4c_value(self) -> u8 {
self as u8
}
#[diplomat::rust_link(
icu::properties::props::IndicSyllabicCategory::from_icu4c_value,
FnInStruct
)]
pub fn from_integer(other: u8) -> Option<Self> {
pub fn from_icu4c_value(other: u8) -> Option<Self> {
Some(match other {
0 => Self::Other,
1 => Self::Avagraha,
Expand Down Expand Up @@ -1611,11 +1611,11 @@ pub mod ffi {

impl JoiningType {
#[diplomat::rust_link(icu::properties::props::JoiningType::to_icu4c_value, FnInStruct)]
pub fn to_integer(self) -> u8 {
pub fn to_icu4c_value(self) -> u8 {
self as u8
}
#[diplomat::rust_link(icu::properties::props::JoiningType::from_icu4c_value, FnInStruct)]
pub fn from_integer(other: u8) -> Option<Self> {
pub fn from_icu4c_value(other: u8) -> Option<Self> {
Some(match other {
0 => Self::NonJoining,
1 => Self::JoinCausing,
Expand Down Expand Up @@ -1744,7 +1744,7 @@ pub mod ffi {
impl GeneralCategory {
/// Convert to an integer using the ICU4C integer mappings for `General_Category`
#[diplomat::rust_link(icu::properties::props::GeneralCategory::to_icu4c_value, FnInStruct)]
pub fn to_integer(self) -> u8 {
pub fn to_icu4c_value(self) -> u8 {
self as u8
}

Expand All @@ -1763,7 +1763,7 @@ pub mod ffi {
Struct,
hidden
)]
pub fn from_integer(other: u8) -> Option<Self> {
pub fn from_icu4c_value(other: u8) -> Option<Self> {
Some(match other {
0 => Self::Unassigned,
1 => Self::UppercaseLetter,
Expand Down

0 comments on commit f66747f

Please sign in to comment.