From 9bd4be596a0220049a5ac9f9b6c53458651f20fe Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Mon, 6 Jan 2025 12:00:46 -0800 Subject: [PATCH] Make locale_prefs private --- components/locale_core/src/preferences/mod.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/components/locale_core/src/preferences/mod.rs b/components/locale_core/src/preferences/mod.rs index 78348aa3de7..56eef51e450 100644 --- a/components/locale_core/src/preferences/mod.rs +++ b/components/locale_core/src/preferences/mod.rs @@ -479,7 +479,7 @@ macro_rules! __define_preferences { #[non_exhaustive] pub struct $name { /// Locale Preferences for the Preferences structure. - pub locale_prefs: $crate::preferences::LocalePreferences, + pub(crate) locale_prefs: $crate::preferences::LocalePreferences, $( $(#[$key_doc])* @@ -564,6 +564,16 @@ macro_rules! __define_preferences { } )* } + + #[doc(hidden)] + pub fn _internal_get_locale_preferences(&self) -> $crate::preferences::LocalePreferences { + self.locale_prefs + } + + #[doc(hidden)] + pub fn _internal_set_locale_preferences(&mut self, prefs: $crate::preferences::LocalePreferences) { + self.locale_prefs = prefs; + } } ) } @@ -578,7 +588,7 @@ macro_rules! __prefs_convert { impl From<&$name1> for $name2 { fn from(other: &$name1) -> Self { let mut result = Self::default(); - result.locale_prefs = other.locale_prefs; + result._internal_set_locale_preferences(other._internal_get_locale_preferences()); result } } @@ -595,7 +605,7 @@ macro_rules! __prefs_convert { impl From<&$name1> for $name2 { fn from(other: &$name1) -> Self { let mut result = Self::default(); - result.locale_prefs = other.locale_prefs; + result._internal_set_locale_preferences(other._internal_get_locale_preferences()); $( result.$key = other.$key; )*