-
Notifications
You must be signed in to change notification settings - Fork 176
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
WIP preferences #5573
base: main
Are you sure you want to change the base?
WIP preferences #5573
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good initial pass; the style is different between icu_collator and icu_decimal
components/decimal/src/lib.rs
Outdated
impl ResolvedFixedDecimalFormatterPreferences { | ||
fn as_data_id(&self) -> DataIdentifierBorrowed { | ||
DataIdentifierBorrowed::for_marker_attributes_and_locale( | ||
DataMarkerAttributes::from_str_or_panic( | ||
self.numbering_system.0.as_str() | ||
), | ||
&self.data_locale, | ||
) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Praise: I like the pattern of pre-computing the DataLocale and putting this code into an associated function.
#[allow(clippy::unwrap_used)] // temporary | ||
ResolvedFixedDecimalFormatterPreferences { | ||
data_locale: DataLocale::from(self.lid), | ||
numbering_system: self.numbering_system.unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: it should just be stored as an Option, I think? We don't actually have a way to retrieve the resolved numbering system from data because that wasn't a design constraint until now. Maybe we should add it to DecimalSymbolsV2, #4437
utils/preferences/src/preferences.rs
Outdated
fn from(loc: icu_locale_core::Locale) -> Self { | ||
|
||
let lid = Some(loc.id); | ||
impl<'a> From<&'a $crate::preferences::icu_locale_core::Locale> for $name<'a> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussion: Do we want an impl from both Locale
and &Locale
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please post discussions in the issue
impl<'a> From<&'a ResolvedCollatorPreferences> for DataIdentifierCow<'a> { | ||
fn from(value: &'a ResolvedCollatorPreferences) -> Self { | ||
Self::from_borrowed_and_owned( | ||
match value.collation_type { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: should this match live here or in icu_preferences
code?
aa9c8d1
to
a33a90a
Compare
#419