diff --git a/components/calendar/src/any_calendar.rs b/components/calendar/src/any_calendar.rs index 4b9551e0666..250955b5f03 100644 --- a/components/calendar/src/any_calendar.rs +++ b/components/calendar/src/any_calendar.rs @@ -413,7 +413,7 @@ impl Calendar for AnyCalendar { } impl AnyCalendar { - /// Constructs an AnyCalendar for a given calendar kind. + /// Constructs an AnyCalendar for a given calendar kind from compiled data. /// /// As this requires a valid [`AnyCalendarKind`] to work, it does not do any kind of locale-based /// fallbacking. If this is desired, use [`Self::new_for_locale()`]. @@ -545,7 +545,7 @@ impl AnyCalendar { }) } - /// Constructs an AnyCalendar for a given calendar kind. + /// Constructs an AnyCalendar for a given calendar kind from compiled data. /// /// In case the locale's calendar is unknown or unspecified, it will attempt to load the default /// calendar for the locale, falling back to gregorian. diff --git a/components/calendar/src/japanese.rs b/components/calendar/src/japanese.rs index 4c502b328b1..74864855b4a 100644 --- a/components/calendar/src/japanese.rs +++ b/components/calendar/src/japanese.rs @@ -110,7 +110,7 @@ pub struct JapaneseDateInner { } impl Japanese { - /// Creates a new [`Japanese`] using only modern eras (post-meiji). + /// Creates a new [`Japanese`] using only modern eras (post-meiji) from compiled data. /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// @@ -136,10 +136,10 @@ impl Japanese { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::new)] pub fn try_new_unstable + ?Sized>( - data_provider: &D, + provider: &D, ) -> Result { Ok(Self { - eras: data_provider.load(Default::default())?.take_payload()?, + eras: provider.load(Default::default())?.take_payload()?, }) } @@ -167,7 +167,7 @@ impl Japanese { } impl JapaneseExtended { - /// Creates a new [`Japanese`] from using all eras (including pre-meiji). + /// Creates a new [`Japanese`] from using all eras (including pre-meiji) from compiled data. /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// @@ -193,13 +193,10 @@ impl JapaneseExtended { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::new)] pub fn try_new_unstable + ?Sized>( - data_provider: &D, + provider: &D, ) -> Result { Ok(Self(Japanese { - eras: data_provider - .load(Default::default())? - .take_payload()? - .cast(), + eras: provider.load(Default::default())?.take_payload()?.cast(), })) } } diff --git a/components/calendar/src/week_of.rs b/components/calendar/src/week_of.rs index 1b1d1f7bb6a..835d03d7a30 100644 --- a/components/calendar/src/week_of.rs +++ b/components/calendar/src/week_of.rs @@ -46,7 +46,7 @@ impl WeekCalculator { locale: include, options: skip, error: CalendarError, - /// Creates a new [`WeekCalculator`] from locale data. + /// Creates a new [`WeekCalculator`] from compiled locale data. ); #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new)] diff --git a/components/collator/src/comparison.rs b/components/collator/src/comparison.rs index 84cfaa114d0..5b41f6dd4a2 100644 --- a/components/collator/src/comparison.rs +++ b/components/collator/src/comparison.rs @@ -68,7 +68,7 @@ pub struct Collator { } impl Collator { - /// Instantiates a collator for a given locale with the given options + /// Creates a collator for the given locale and options from compiled data. #[cfg(feature = "compiled_data")] pub fn try_new(locale: &DataLocale, options: CollatorOptions) -> Result { Self::try_new_unstable_internal( @@ -99,7 +99,7 @@ impl Collator { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new)] pub fn try_new_unstable( - data_provider: &D, + provider: &D, locale: &DataLocale, options: CollatorOptions, ) -> Result @@ -115,18 +115,18 @@ impl Collator { + ?Sized, { Self::try_new_unstable_internal( - data_provider, - data_provider.load(Default::default())?.take_payload()?, - data_provider.load(Default::default())?.take_payload()?, - data_provider.load(Default::default())?.take_payload()?, - || data_provider.load(Default::default())?.take_payload(), + provider, + provider.load(Default::default())?.take_payload()?, + provider.load(Default::default())?.take_payload()?, + provider.load(Default::default())?.take_payload()?, + || provider.load(Default::default())?.take_payload(), locale, options, ) } fn try_new_unstable_internal( - data_provider: &D, + provider: &D, decompositions: DataPayload, tables: DataPayload, jamo: DataPayload, @@ -150,20 +150,20 @@ impl Collator { }; let metadata_payload: DataPayload = - data_provider.load(req)?.take_payload()?; + provider.load(req)?.take_payload()?; let metadata = metadata_payload.get(); let tailoring: Option> = if metadata.tailored() { - Some(data_provider.load(req)?.take_payload()?) + Some(provider.load(req)?.take_payload()?) } else { None }; let reordering: Option> = if metadata.reordering() { - Some(data_provider.load(req)?.take_payload()?) + Some(provider.load(req)?.take_payload()?) } else { None }; @@ -175,10 +175,10 @@ impl Collator { } let root: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; let tailored_diacritics = metadata.tailored_diacritics(); - let diacritics: DataPayload = data_provider + let diacritics: DataPayload = provider .load(if tailored_diacritics { req } else { diff --git a/components/datetime/src/any/date.rs b/components/datetime/src/any/date.rs index 8b79ff2c8f0..b43b520fa50 100644 --- a/components/datetime/src/any/date.rs +++ b/components/datetime/src/any/date.rs @@ -68,6 +68,10 @@ impl DateFormatter { /// This method will pick the calendar off of the locale; and if unspecified or unknown will fall back to the default /// calendar for the locale. See [`AnyCalendarKind`] for a list of supported calendars. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` @@ -96,10 +100,6 @@ impl DateFormatter { /// "Sep 1, 2020" /// ); /// ``` - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* - /// - /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[inline(never)] #[cfg(feature = "compiled_data")] pub fn try_new_with_length( diff --git a/components/datetime/src/any/datetime.rs b/components/datetime/src/any/datetime.rs index ad39b69c307..a52383ff37b 100644 --- a/components/datetime/src/any/datetime.rs +++ b/components/datetime/src/any/datetime.rs @@ -118,6 +118,10 @@ impl DateTimeFormatter { /// This method will pick the calendar off of the locale; and if unspecified or unknown will fall back to the default /// calendar for the locale. See [`AnyCalendarKind`] for a list of supported calendars. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` @@ -268,6 +272,10 @@ impl DateTimeFormatter { /// Constructor that supports experimental options with compiled data. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// ///
/// 🚧 This code is experimental; it may change at any time, in breaking or non-breaking ways, /// including in SemVer minor releases. It can be enabled with the "experimental" Cargo feature diff --git a/components/datetime/src/any/zoned_datetime.rs b/components/datetime/src/any/zoned_datetime.rs index 9a7e01dec06..abdfe159274 100644 --- a/components/datetime/src/any/zoned_datetime.rs +++ b/components/datetime/src/any/zoned_datetime.rs @@ -127,6 +127,10 @@ impl ZonedDateTimeFormatter { /// This method will pick the calendar off of the locale; and if unspecified or unknown will fall back to the default /// calendar for the locale. See [`AnyCalendarKind`] for a list of supported calendars. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` @@ -163,10 +167,6 @@ impl ZonedDateTimeFormatter { /// "April 2021, 16:12 GMT-07:00" /// ); /// ``` - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* - /// - /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "experimental")] #[cfg(feature = "compiled_data")] pub fn try_new_experimental( @@ -276,6 +276,10 @@ impl ZonedDateTimeFormatter { /// This method will pick the calendar off of the locale; and if unspecified or unknown will fall back to the default /// calendar for the locale. See [`AnyCalendarKind`] for a list of supported calendars. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` @@ -311,10 +315,6 @@ impl ZonedDateTimeFormatter { /// "Apr 8, 2021, 4:12:37β€―PM GMT-07:00" /// ); /// ``` - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* - /// - /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] pub fn try_new( locale: &DataLocale, diff --git a/components/datetime/src/datetime.rs b/components/datetime/src/datetime.rs index 089f350316d..ceccc72087a 100644 --- a/components/datetime/src/datetime.rs +++ b/components/datetime/src/datetime.rs @@ -68,10 +68,9 @@ impl TimeFormatter { /// compiled data necessary to format date and time values into the given locale, /// using the given style. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// /// [πŸ“š Help choosing a constructor](icu_provider::constructors) - ///
- /// ⚠️ The bounds on this function may change over time, including in SemVer minor releases. - ///
/// /// # Examples /// @@ -85,10 +84,6 @@ impl TimeFormatter { /// ) /// .unwrap(); /// ``` - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* - /// - /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] pub fn try_new_with_length( locale: &DataLocale, @@ -120,7 +115,7 @@ impl TimeFormatter { #[inline] #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new_with_length)] pub fn try_new_with_length_unstable( - data_provider: &D, + provider: &D, locale: &DataLocale, length: length::Time, ) -> Result @@ -133,7 +128,7 @@ impl TimeFormatter { let preferences = Some(preferences::Bag::from_data_locale(locale)); Ok(Self(raw::TimeFormatter::try_new_unstable( - data_provider, + provider, locale, length, preferences, @@ -234,8 +229,12 @@ impl TimeFormatter { pub struct TypedDateFormatter(pub(super) raw::DateFormatter, PhantomData); impl TypedDateFormatter { - /// Constructor that takes a selected locale and a list of options, then collects all data - /// necessary to format date and time values into the given locale. + /// Constructor that takes a selected locale and a list of options, then collects all + /// compiled data necessary to format date and time values into the given locale. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Examples /// @@ -284,10 +283,6 @@ impl TypedDateFormatter { /// ``` /// /// [`DateFormatter`]: crate::DateFormatter - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* - /// - /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] pub fn try_new_with_length( locale: &DataLocale, @@ -330,7 +325,7 @@ impl TypedDateFormatter { #[inline] #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new_with_length)] pub fn try_new_with_length_unstable( - data_provider: &D, + provider: &D, locale: &DataLocale, length: length::Date, ) -> Result @@ -344,9 +339,9 @@ impl TypedDateFormatter { { Ok(Self( raw::DateFormatter::try_new_unstable( - data_provider, - calendar::load_lengths_for_cldr_calendar::(data_provider, locale)?, - || calendar::load_symbols_for_cldr_calendar::(data_provider, locale), + provider, + calendar::load_lengths_for_cldr_calendar::(provider, locale)?, + || calendar::load_symbols_for_cldr_calendar::(provider, locale), locale, length, )?, @@ -493,7 +488,12 @@ where { )) } - /// Constructor that takes a selected locale, then uses compiled data to format date and time values into the given locale. + /// Constructor that takes a selected locale, then collects all + /// compiled data necessary to format date and time values into the given locale. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Examples /// @@ -521,10 +521,6 @@ where { /// ``` /// /// [data provider]: icu_provider - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* - /// - /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] pub fn try_new( locale: &DataLocale, @@ -572,7 +568,7 @@ where { #[inline] #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new)] pub fn try_new_unstable( - data_provider: &D, + provider: &D, locale: &DataLocale, options: DateTimeFormatterOptions, ) -> Result @@ -587,16 +583,16 @@ where { + ?Sized, { let patterns = PatternSelector::for_options( - data_provider, - calendar::load_lengths_for_cldr_calendar::(data_provider, locale)?, + provider, + calendar::load_lengths_for_cldr_calendar::(provider, locale)?, locale, &options, )?; Ok(Self( raw::DateTimeFormatter::try_new_unstable( - data_provider, + provider, patterns, - || calendar::load_symbols_for_cldr_calendar::(data_provider, locale), + || calendar::load_symbols_for_cldr_calendar::(provider, locale), locale, )?, PhantomData, @@ -605,6 +601,10 @@ where { /// Constructor that supports experimental options using compiled data. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// ///
/// 🚧 This code is experimental; it may change at any time, in breaking or non-breaking ways, /// including in SemVer minor releases. It can be enabled with the "experimental" Cargo feature @@ -639,10 +639,6 @@ where { /// ``` /// /// [data provider]: icu_provider - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* - /// - /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "experimental")] #[inline] #[cfg(feature = "compiled_data")] @@ -715,7 +711,7 @@ where { #[cfg(feature = "experimental")] #[inline] pub fn try_new_experimental_unstable( - data_provider: &D, + provider: &D, locale: &DataLocale, options: DateTimeFormatterOptions, ) -> Result @@ -731,17 +727,17 @@ where { + ?Sized, { let patterns = PatternSelector::for_options_experimental( - data_provider, - calendar::load_lengths_for_cldr_calendar::(data_provider, locale)?, + provider, + calendar::load_lengths_for_cldr_calendar::(provider, locale)?, locale, &C::DEFAULT_BCP_47_IDENTIFIER, &options, )?; Ok(Self( raw::DateTimeFormatter::try_new_unstable( - data_provider, + provider, patterns, - || calendar::load_symbols_for_cldr_calendar::(data_provider, locale), + || calendar::load_symbols_for_cldr_calendar::(provider, locale), locale, )?, PhantomData, diff --git a/components/datetime/src/time_zone.rs b/components/datetime/src/time_zone.rs index ac9ccbe3cbb..b1b0ffa381f 100644 --- a/components/datetime/src/time_zone.rs +++ b/components/datetime/src/time_zone.rs @@ -408,6 +408,10 @@ impl TimeZoneFormatter { /// To enable other time zone styles, use one of the `with` (compiled data) or `load` (runtime /// data provider) methods. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// Default format is Localized GMT: diff --git a/components/datetime/src/zoned_datetime.rs b/components/datetime/src/zoned_datetime.rs index 06a38a3b347..208ab49ab04 100644 --- a/components/datetime/src/zoned_datetime.rs +++ b/components/datetime/src/zoned_datetime.rs @@ -81,6 +81,10 @@ impl TypedZonedDateTimeFormatter { /// Constructor that takes a selected locale and a list of [`DateTimeFormatterOptions`]. /// It collects all data necessary to format zoned datetime values into the given locale. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// ///
/// 🚧 This code is experimental; it may change at any time, in breaking or non-breaking ways, /// including in SemVer minor releases. It can be enabled with the "experimental" Cargo feature @@ -204,6 +208,10 @@ impl TypedZonedDateTimeFormatter { /// Constructor that takes a selected locale and a list of [`DateTimeFormatterOptions`]. /// It collects all data necessary to format zoned datetime values into the given locale. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` diff --git a/components/decimal/src/lib.rs b/components/decimal/src/lib.rs index c98d65b9253..f0e8d22c2c9 100644 --- a/components/decimal/src/lib.rs +++ b/components/decimal/src/lib.rs @@ -133,16 +133,20 @@ impl FixedDecimalFormatter { locale: include, options: options::FixedDecimalFormatterOptions, error: DecimalError, - /// Creates a new [`FixedDecimalFormatter`] from locale data and an options bag. + /// Creates a new [`FixedDecimalFormatter`] from compiled locale data and an options bag. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) ); #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new)] pub fn try_new_unstable + ?Sized>( - data_provider: &D, + provider: &D, locale: &DataLocale, options: options::FixedDecimalFormatterOptions, ) -> Result { - let symbols = data_provider + let symbols = provider .load(DataRequest { locale, metadata: Default::default(), diff --git a/components/list/src/list_formatter.rs b/components/list/src/list_formatter.rs index c5ca974455f..8dfd090718d 100644 --- a/components/list/src/list_formatter.rs +++ b/components/list/src/list_formatter.rs @@ -26,10 +26,14 @@ macro_rules! constructor { locale: include, style: ListLength, error: ListError, - #[doc = concat!("Creates a new [`ListFormatter`] that produces a ", $doc, "-type list.")] + #[doc = concat!("Creates a new [`ListFormatter`] that produces a ", $doc, "-type list using compiled data.")] /// /// See the [CLDR spec](https://unicode.org/reports/tr35/tr35-general.html#ListPatterns) for /// an explanation of the different types. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) functions: [ $name, $name_any, @@ -41,11 +45,11 @@ macro_rules! constructor { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::$name)] pub fn $name_unstable( - data_provider: &(impl DataProvider<$marker> + ?Sized), + provider: &(impl DataProvider<$marker> + ?Sized), locale: &DataLocale, length: ListLength, ) -> Result { - let data = data_provider + let data = provider .load(DataRequest { locale, metadata: Default::default(), diff --git a/components/locid_transform/src/canonicalizer.rs b/components/locid_transform/src/canonicalizer.rs index 150ce41897a..cbbb92e1449 100644 --- a/components/locid_transform/src/canonicalizer.rs +++ b/components/locid_transform/src/canonicalizer.rs @@ -216,7 +216,7 @@ impl Default for LocaleCanonicalizer { } impl LocaleCanonicalizer { - /// A constructor which creates a [`LocaleCanonicalizer`]. + /// A constructor which creates a [`LocaleCanonicalizer`] from compiled data. /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// @@ -257,7 +257,7 @@ impl LocaleCanonicalizer { Self::try_new_with_expander_unstable(provider, expander) } - /// Creates a [`LocaleCanonicalizer`] with a custom [`LocaleExpander`] object. + /// Creates a [`LocaleCanonicalizer`] with a custom [`LocaleExpander`] and compiled data. /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// diff --git a/components/locid_transform/src/directionality.rs b/components/locid_transform/src/directionality.rs index 5ff8b89ae7a..806f7aeb213 100644 --- a/components/locid_transform/src/directionality.rs +++ b/components/locid_transform/src/directionality.rs @@ -56,7 +56,7 @@ pub struct LocaleDirectionality { } impl LocaleDirectionality { - /// A constructor which creates a [`LocaleDirectionality`]. + /// A constructor which creates a [`LocaleDirectionality`] from compiled data. #[cfg(feature = "compiled_data")] pub const fn new() -> Self { Self::new_with_expander(LocaleExpander::new()) @@ -93,7 +93,7 @@ impl LocaleDirectionality { Self::try_new_with_expander_unstable(provider, expander) } - /// Creates a [`LocaleDirectionality`] with a custom [`LocaleExpander`] object. + /// Creates a [`LocaleDirectionality`] with a custom [`LocaleExpander`] and compiled data. /// /// For example, use this constructor if you wish to support all languages. /// diff --git a/components/locid_transform/src/expander.rs b/components/locid_transform/src/expander.rs index 055083ab854..880271eecd1 100644 --- a/components/locid_transform/src/expander.rs +++ b/components/locid_transform/src/expander.rs @@ -190,7 +190,7 @@ fn update_langid( } impl LocaleExpander { - /// Creates a [`LocaleExpander`] with data for all locales. + /// Creates a [`LocaleExpander`] with compiled data for all locales. /// /// Use this constructor if you are using likely subtags for comprehensive support of all /// languages and regions, including ones that may not have CLDR data. @@ -244,7 +244,7 @@ impl LocaleExpander { Self ]); - /// Creates a [`LocaleExpander`] with data for CLDR locales with Basic or higher coverage. + /// Creates a [`LocaleExpander`] with compiled data for CLDR locales with Basic or higher coverage. /// /// Use this constructor if you are using likely subtags for comprehensive support of all /// languages and regions, including ones that may not have CLDR data. diff --git a/components/locid_transform/src/fallback/mod.rs b/components/locid_transform/src/fallback/mod.rs index 2b642d48c77..bd169d57730 100644 --- a/components/locid_transform/src/fallback/mod.rs +++ b/components/locid_transform/src/fallback/mod.rs @@ -289,7 +289,7 @@ pub struct LocaleFallbackIterator<'a, 'b> { } impl LocaleFallbacker { - /// Creates a [`LocaleFallbacker`] with fallback data (likely subtags and parent locales). + /// Creates a [`LocaleFallbacker`] with compiled fallback data (likely subtags and parent locales). /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// diff --git a/components/normalizer/src/lib.rs b/components/normalizer/src/lib.rs index 52324b82450..5f0d6c23e5a 100644 --- a/components/normalizer/src/lib.rs +++ b/components/normalizer/src/lib.rs @@ -1524,7 +1524,7 @@ pub struct DecomposingNormalizer { } impl DecomposingNormalizer { - /// NFD constructor. + /// NFD constructor using compiled data. /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// @@ -1571,16 +1571,16 @@ impl DecomposingNormalizer { ); #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::new_nfd)] - pub fn try_new_nfd_unstable(data_provider: &D) -> Result + pub fn try_new_nfd_unstable(provider: &D) -> Result where D: DataProvider + DataProvider + ?Sized, { let decompositions: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; let tables: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; if tables.get().scalars16.len() + tables.get().scalars24.len() > 0xFFF { // The data is from a future where there exists a normalization flavor whose @@ -1602,7 +1602,7 @@ impl DecomposingNormalizer { }) } - /// NFKD constructor. + /// NFKD constructor using compiled data. /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// @@ -1677,7 +1677,7 @@ impl DecomposingNormalizer { ); #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::new_nfkd)] - pub fn try_new_nfkd_unstable(data_provider: &D) -> Result + pub fn try_new_nfkd_unstable(provider: &D) -> Result where D: DataProvider + DataProvider @@ -1686,14 +1686,14 @@ impl DecomposingNormalizer { + ?Sized, { let decompositions: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; let supplementary_decompositions: DataPayload< CompatibilityDecompositionSupplementV1Marker, - > = data_provider.load(Default::default())?.take_payload()?; + > = provider.load(Default::default())?.take_payload()?; let tables: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; let supplementary_tables: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; if tables.get().scalars16.len() + tables.get().scalars24.len() @@ -1809,7 +1809,7 @@ impl DecomposingNormalizer { #[doc(hidden)] #[cfg(feature = "experimental")] pub fn try_new_uts46_decomposed_without_ignored_and_disallowed_unstable( - data_provider: &D, + provider: &D, ) -> Result where D: DataProvider @@ -1820,13 +1820,13 @@ impl DecomposingNormalizer { + ?Sized, { let decompositions: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; let supplementary_decompositions: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; let tables: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; let supplementary_tables: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; if tables.get().scalars16.len() + tables.get().scalars24.len() @@ -2143,7 +2143,7 @@ pub struct ComposingNormalizer { } impl ComposingNormalizer { - /// NFC constructor. + /// NFC constructor using compiled data. /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// @@ -2173,17 +2173,17 @@ impl ComposingNormalizer { ); #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::new_nfc)] - pub fn try_new_nfc_unstable(data_provider: &D) -> Result + pub fn try_new_nfc_unstable(provider: &D) -> Result where D: DataProvider + DataProvider + DataProvider + ?Sized, { - let decomposing_normalizer = DecomposingNormalizer::try_new_nfd_unstable(data_provider)?; + let decomposing_normalizer = DecomposingNormalizer::try_new_nfd_unstable(provider)?; let canonical_compositions: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; Ok(ComposingNormalizer { decomposing_normalizer, @@ -2191,7 +2191,7 @@ impl ComposingNormalizer { }) } - /// NFKC constructor. + /// NFKC constructor using compiled data. /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// @@ -2221,7 +2221,7 @@ impl ComposingNormalizer { ); #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::new_nfkc)] - pub fn try_new_nfkc_unstable(data_provider: &D) -> Result + pub fn try_new_nfkc_unstable(provider: &D) -> Result where D: DataProvider + DataProvider @@ -2230,10 +2230,10 @@ impl ComposingNormalizer { + DataProvider + ?Sized, { - let decomposing_normalizer = DecomposingNormalizer::try_new_nfkd_unstable(data_provider)?; + let decomposing_normalizer = DecomposingNormalizer::try_new_nfkd_unstable(provider)?; let canonical_compositions: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; Ok(ComposingNormalizer { decomposing_normalizer, @@ -2285,7 +2285,7 @@ impl ComposingNormalizer { ///
#[cfg(feature = "experimental")] pub fn try_new_uts46_without_ignored_and_disallowed_unstable( - data_provider: &D, + provider: &D, ) -> Result where D: DataProvider @@ -2298,11 +2298,11 @@ impl ComposingNormalizer { { let decomposing_normalizer = DecomposingNormalizer::try_new_uts46_decomposed_without_ignored_and_disallowed_unstable( - data_provider, + provider, )?; let canonical_compositions: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; Ok(ComposingNormalizer { decomposing_normalizer, diff --git a/components/normalizer/src/properties.rs b/components/normalizer/src/properties.rs index 68ed08bf2a2..631cb281fda 100644 --- a/components/normalizer/src/properties.rs +++ b/components/normalizer/src/properties.rs @@ -84,7 +84,11 @@ impl CanonicalComposition { ) } - /// Constructs a new `CanonicalComposition`. + /// Constructs a new `CanonicalComposition` using compiled data. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] pub fn new() -> Self { Self { @@ -106,12 +110,12 @@ impl CanonicalComposition { ); #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::new)] - pub fn try_new_unstable(data_provider: &D) -> Result + pub fn try_new_unstable(provider: &D) -> Result where D: DataProvider + ?Sized, { let canonical_compositions: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; Ok(CanonicalComposition { canonical_compositions, }) @@ -338,7 +342,11 @@ impl CanonicalDecomposition { Decomposed::Default } - /// Construct from built-in data. + /// Construct from compiled data. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] pub const fn new() -> Self { const _: () = assert!( @@ -377,7 +385,7 @@ impl CanonicalDecomposition { ); #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::new)] - pub fn try_new_unstable(data_provider: &D) -> Result + pub fn try_new_unstable(provider: &D) -> Result where D: DataProvider + DataProvider @@ -385,9 +393,9 @@ impl CanonicalDecomposition { + ?Sized, { let decompositions: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; let tables: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; if tables.get().scalars16.len() + tables.get().scalars24.len() > 0xFFF { // The data is from a future where there exists a normalization flavor whose @@ -400,7 +408,7 @@ impl CanonicalDecomposition { } let non_recursive: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; Ok(CanonicalDecomposition { decompositions, @@ -452,7 +460,11 @@ impl CanonicalCombiningClassMap { } } - /// Construct from built-in data. + /// Construct from compiled data. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] pub const fn new() -> Self { CanonicalCombiningClassMap { @@ -473,12 +485,12 @@ impl CanonicalCombiningClassMap { ]); #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::new)] - pub fn try_new_unstable(data_provider: &D) -> Result + pub fn try_new_unstable(provider: &D) -> Result where D: DataProvider + ?Sized, { let decompositions: DataPayload = - data_provider.load(Default::default())?.take_payload()?; + provider.load(Default::default())?.take_payload()?; Ok(CanonicalCombiningClassMap { decompositions }) } } diff --git a/components/plurals/src/lib.rs b/components/plurals/src/lib.rs index 3a3c6f1a9d3..e31f870b40d 100644 --- a/components/plurals/src/lib.rs +++ b/components/plurals/src/lib.rs @@ -290,7 +290,11 @@ impl PluralRules { locale: include, rule_type: PluralRuleType, error: PluralsError, - /// Constructs a new `PluralRules` for a given locale and type. + /// Constructs a new `PluralRules` for a given locale and type using compiled data. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Examples /// @@ -310,13 +314,13 @@ impl PluralRules { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new)] pub fn try_new_unstable( - data_provider: &(impl DataProvider + DataProvider + ?Sized), + provider: &(impl DataProvider + DataProvider + ?Sized), locale: &DataLocale, rule_type: PluralRuleType, ) -> Result { match rule_type { - PluralRuleType::Cardinal => Self::try_new_cardinal_unstable(data_provider, locale), - PluralRuleType::Ordinal => Self::try_new_ordinal_unstable(data_provider, locale), + PluralRuleType::Cardinal => Self::try_new_cardinal_unstable(provider, locale), + PluralRuleType::Ordinal => Self::try_new_ordinal_unstable(provider, locale), } } @@ -324,7 +328,7 @@ impl PluralRules { locale: include, options: skip, error: PluralsError, - /// Constructs a new `PluralRules` for a given locale for cardinal numbers. + /// Constructs a new `PluralRules` for a given locale for cardinal numbers using compiled data. /// /// Cardinal plural forms express quantities of units such as time, currency or distance, /// used in conjunction with a number expressed in decimal digits (i.e. "2", not "two"). @@ -334,6 +338,10 @@ impl PluralRules { /// * [`One`]: `1 day` /// * [`Other`]: `0 days`, `2 days`, `10 days`, `0.3 days` /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` @@ -358,11 +366,11 @@ impl PluralRules { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new_cardinal)] pub fn try_new_cardinal_unstable( - data_provider: &(impl DataProvider + ?Sized), + provider: &(impl DataProvider + ?Sized), locale: &DataLocale, ) -> Result { Ok(Self( - data_provider + provider .load(DataRequest { locale, metadata: Default::default(), @@ -376,7 +384,7 @@ impl PluralRules { locale: include, options: skip, error: PluralsError, - /// Constructs a new `PluralRules` for a given locale for ordinal numbers. + /// Constructs a new `PluralRules` for a given locale for ordinal numbers using compiled data. /// /// Ordinal plural forms denote the order of items in a set and are always integers. /// @@ -387,6 +395,10 @@ impl PluralRules { /// * [`Few`]: `3rd floor`, `23rd floor`, `103rd floor` /// * [`Other`]: `4th floor`, `11th floor`, `96th floor` /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` @@ -416,11 +428,11 @@ impl PluralRules { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new_ordinal)] pub fn try_new_ordinal_unstable( - data_provider: &(impl DataProvider + ?Sized), + provider: &(impl DataProvider + ?Sized), locale: &DataLocale, ) -> Result { Ok(Self( - data_provider + provider .load(DataRequest { locale, metadata: Default::default(), diff --git a/components/properties/src/bidi_data.rs b/components/properties/src/bidi_data.rs index a11d58b91d6..c1d49d9f68c 100644 --- a/components/properties/src/bidi_data.rs +++ b/components/properties/src/bidi_data.rs @@ -168,9 +168,13 @@ impl BidiAuxiliaryPropertiesBorrowed<'static> { } } -/// Returns a [`BidiAuxiliaryPropertiesV1`] struct that represents the data for certain +/// Creates a [`BidiAuxiliaryPropertiesV1`] struct that represents the data for certain /// Bidi properties. /// +/// ✨ *Enabled with the `compiled_data` Cargo feature.* +/// +/// [πŸ“š Help choosing a constructor](icu_provider::constructors) +/// /// # Examples /// ``` /// use icu_properties::{bidi_data, bidi_data::BidiMirroringProperties}; @@ -181,8 +185,6 @@ impl BidiAuxiliaryPropertiesBorrowed<'static> { /// assert_eq!(open_paren.mirroring_glyph, Some(')')); /// assert_eq!(open_paren.mirrored, true); /// ``` -/// -/// ✨ *Enabled with the `compiled_data` Cargo feature.* #[cfg(feature = "compiled_data")] pub const fn bidi_auxiliary_properties() -> BidiAuxiliaryPropertiesBorrowed<'static> { BidiAuxiliaryPropertiesBorrowed { diff --git a/components/properties/src/exemplar_chars.rs b/components/properties/src/exemplar_chars.rs index 4c884fcca23..fc01bc743fa 100644 --- a/components/properties/src/exemplar_chars.rs +++ b/components/properties/src/exemplar_chars.rs @@ -45,7 +45,9 @@ macro_rules! make_exemplar_chars_unicode_set_property { $(#[$attr:meta])* $vis2:vis fn $constname:ident(); ) => { - #[doc = concat!("[`", stringify!($constname), "()`] with a runtime data provider argument.")] + #[doc = concat!("A version of [`", stringify!($constname), "()`] that uses custom data provided by a [`DataProvider`].")] + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) $vis fn $funcname( provider: &(impl DataProvider<$keyed_data_marker> + ?Sized), locale: &DataLocale, @@ -60,8 +62,6 @@ macro_rules! make_exemplar_chars_unicode_set_property { ) } $(#[$attr])* - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* #[cfg(feature = "compiled_data")] $vis2 fn $constname( locale: &DataLocale, @@ -87,6 +87,10 @@ make_exemplar_chars_unicode_set_property!( /// Get the "main" set of exemplar characters. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` @@ -115,6 +119,10 @@ make_exemplar_chars_unicode_set_property!( /// Get the "auxiliary" set of exemplar characters. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` @@ -144,6 +152,10 @@ make_exemplar_chars_unicode_set_property!( /// Get the "punctuation" set of exemplar characters. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` @@ -174,6 +186,10 @@ make_exemplar_chars_unicode_set_property!( /// Get the "numbers" set of exemplar characters. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` @@ -204,6 +220,10 @@ make_exemplar_chars_unicode_set_property!( /// Get the "index" set of exemplar characters. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` diff --git a/components/properties/src/maps.rs b/components/properties/src/maps.rs index 9162a34e21b..2d6d5235d49 100644 --- a/components/properties/src/maps.rs +++ b/components/properties/src/maps.rs @@ -315,18 +315,18 @@ macro_rules! make_map_property { $vis2:vis const $constname:ident => $singleton:ident; $vis:vis fn $name:ident(); ) => { - #[doc = concat!("[`", stringify!($constname), "()`] with a runtime data provider argument.")] + #[doc = concat!("A version of [`", stringify!($constname), "()`] that uses custom data provided by a [`DataProvider`].")] /// /// Note that this will return an owned version of the data. Functionality is available on - /// the borrowed version, accessible through `.as_borrowed()`. + /// the borrowed version, accessible through [`CodePointMapData::as_borrowed`]. + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) $vis fn $name( provider: &(impl DataProvider<$keyed_data_marker> + ?Sized) ) -> Result, PropertiesError> { Ok(provider.load(Default::default()).and_then(DataResponse::take_payload).map(CodePointMapData::from_data)?) } $(#[$doc])* - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* #[cfg(feature = "compiled_data")] pub const fn $constname() -> CodePointMapDataBorrowed<'static, $value_ty> { CodePointMapDataBorrowed { @@ -344,6 +344,10 @@ make_map_property! { func: /// Return a [`CodePointMapDataBorrowed`] for the General_Category Unicode enumerated property. See [`GeneralCategory`]. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -364,6 +368,10 @@ make_map_property! { func: /// Return a [`CodePointMapDataBorrowed`] for the Bidi_Class Unicode enumerated property. See [`BidiClass`]. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -389,6 +397,10 @@ make_map_property! { /// [`load_script_with_extensions_unstable`] and [`ScriptWithExtensionsBorrowed::has_script`] /// instead of this function. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -412,6 +424,10 @@ make_map_property! { /// Return a [`CodePointMapDataBorrowed`] for the East_Asian_Width Unicode enumerated /// property. See [`EastAsianWidth`]. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -433,6 +449,10 @@ make_map_property! { /// Return a [`CodePointMapDataBorrowed`] for the Line_Break Unicode enumerated /// property. See [`LineBreak`]. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// **Note:** Use `icu::segmenter` for an all-in-one break iterator implementation. /// /// # Example @@ -456,6 +476,10 @@ make_map_property! { /// Return a [`CodePointMapDataBorrowed`] for the Grapheme_Cluster_Break Unicode enumerated /// property. See [`GraphemeClusterBreak`]. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// **Note:** Use `icu::segmenter` for an all-in-one break iterator implementation. /// /// # Example @@ -479,6 +503,10 @@ make_map_property! { /// Return a [`CodePointMapDataBorrowed`] for the Word_Break Unicode enumerated /// property. See [`WordBreak`]. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// **Note:** Use `icu::segmenter` for an all-in-one break iterator implementation. /// /// # Example @@ -502,6 +530,10 @@ make_map_property! { /// Return a [`CodePointMapDataBorrowed`] for the Sentence_Break Unicode enumerated /// property. See [`SentenceBreak`]. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// **Note:** Use `icu::segmenter` for an all-in-one break iterator implementation. /// /// # Example @@ -525,6 +557,10 @@ make_map_property! { /// Return a [`CodePointMapData`] for the Canonical_Combining_Class Unicode property. See /// [`CanonicalCombiningClass`]. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// **Note:** See `icu_normalizer::CanonicalCombiningClassMap` for the preferred API /// to look up the Canonical_Combining_Class property by scalar value. /// diff --git a/components/properties/src/props.rs b/components/properties/src/props.rs index 2b4a2da541a..5db3a39567f 100644 --- a/components/properties/src/props.rs +++ b/components/properties/src/props.rs @@ -595,8 +595,6 @@ macro_rules! impl_value_getter { ) => { impl $ty { $(#[$attr_n2e])* - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* #[cfg(feature = "compiled_data")] $vis_n2e fn $cname_n2e() -> PropertyValueNameToEnumMapperBorrowed<'static, $ty> { PropertyValueNameToEnumMapperBorrowed { @@ -605,7 +603,9 @@ macro_rules! impl_value_getter { } } - #[doc = concat!("[`", stringify!($ty), "::", stringify!($cname_n2e), "()`] with a runtime data provider argument.")] + #[doc = concat!("A version of [`", stringify!($ty), "::", stringify!($cname_n2e), "()`] that uses custom data provided by a [`DataProvider`].")] + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) $vis_n2e fn $name_n2e( provider: &(impl DataProvider<$marker_n2e> + ?Sized) ) -> Result, PropertiesError> { @@ -614,8 +614,6 @@ macro_rules! impl_value_getter { $( $(#[$attr_e2sn])* - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* #[cfg(feature = "compiled_data")] $vis_e2sn fn $cname_e2sn() -> $mapper_e2snb<'static, $ty> { $mapper_e2snb { @@ -624,7 +622,9 @@ macro_rules! impl_value_getter { } } - #[doc = concat!("[`", stringify!($ty), "::", stringify!($cname_e2sn), "()`] with a runtime data provider argument.")] + #[doc = concat!("A version of [`", stringify!($ty), "::", stringify!($cname_e2sn), "()`] that uses custom data provided by a [`DataProvider`].")] + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) $vis_e2sn fn $name_e2sn( provider: &(impl DataProvider<$marker_e2sn> + ?Sized) ) -> Result<$mapper_e2sn<$ty>, PropertiesError> { @@ -632,8 +632,6 @@ macro_rules! impl_value_getter { } $(#[$attr_e2ln])* - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* #[cfg(feature = "compiled_data")] $vis_e2ln fn $cname_e2ln() -> $mapper_e2lnb<'static, $ty> { $mapper_e2lnb { @@ -642,7 +640,9 @@ macro_rules! impl_value_getter { } } - #[doc = concat!("[`", stringify!($ty), "::", stringify!($cname_e2ln), "()`] with a runtime data provider argument.")] + #[doc = concat!("A version of [`", stringify!($ty), "::", stringify!($cname_e2ln), "()`] that uses custom data provided by a [`DataProvider`].")] + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) $vis_e2ln fn $name_e2ln( provider: &(impl DataProvider<$marker_e2ln> + ?Sized) ) -> Result<$mapper_e2ln<$ty>, PropertiesError> { @@ -723,6 +723,10 @@ impl_value_getter! { /// Return a [`PropertyValueNameToEnumMapper`], capable of looking up values /// from strings for the `Bidi_Class` enumerated property /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -746,6 +750,10 @@ impl_value_getter! { /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up short names /// for values of the `Bidi_Class` enumerated property /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -759,6 +767,10 @@ impl_value_getter! { /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up long names /// for values of the `Bidi_Class` enumerated property /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -861,7 +873,11 @@ impl_value_getter! { markers: GeneralCategoryNameToValueV1Marker / SINGLETON_PROPNAMES_FROM_GC_V1, GeneralCategoryValueToShortNameV1Marker / SINGLETON_PROPNAMES_TO_SHORT_LINEAR_GC_V1, GeneralCategoryValueToLongNameV1Marker / SINGLETON_PROPNAMES_TO_LONG_LINEAR_GC_V1; impl GeneralCategory { /// Return a [`PropertyValueNameToEnumMapper`], capable of looking up values - /// from strings for the `General_Category` enumerated property + /// from strings for the `General_Category` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -884,7 +900,11 @@ impl_value_getter! { /// ``` pub fn get_name_to_enum_mapper() / name_to_enum_mapper(); /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up short names - /// for values of the `General_Category` enumerated property + /// for values of the `General_Category` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -897,7 +917,11 @@ impl_value_getter! { /// ``` pub fn get_enum_to_short_name_mapper() / enum_to_short_name_mapper() -> PropertyEnumToValueNameLinearMapper / PropertyEnumToValueNameLinearMapperBorrowed; /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up long names - /// for values of the `General_Category` enumerated property + /// for values of the `General_Category` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1208,7 +1232,11 @@ impl_value_getter! { markers: GeneralCategoryMaskNameToValueV1Marker / SINGLETON_PROPNAMES_FROM_GCM_V1; impl GeneralCategoryGroup { /// Return a [`PropertyValueNameToEnumMapper`], capable of looking up values - /// from strings for the `General_Category_Mask` mask property + /// from strings for the `General_Category_Mask` mask property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1448,7 +1476,11 @@ impl_value_getter! { markers: ScriptNameToValueV1Marker / SINGLETON_PROPNAMES_FROM_SC_V1, ScriptValueToShortNameV1Marker / SINGLETON_PROPNAMES_TO_SHORT_LINEAR4_SC_V1, ScriptValueToLongNameV1Marker / SINGLETON_PROPNAMES_TO_LONG_LINEAR_SC_V1; impl Script { /// Return a [`PropertyValueNameToEnumMapper`], capable of looking up values - /// from strings for the `Script` enumerated property + /// from strings for the `Script` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1471,7 +1503,11 @@ impl_value_getter! { /// ``` pub fn get_name_to_enum_mapper() / name_to_enum_mapper(); /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up short names - /// for values of the `Script` enumerated property + /// for values of the `Script` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1485,7 +1521,11 @@ impl_value_getter! { /// ``` pub fn get_enum_to_short_name_mapper() / enum_to_short_name_mapper() -> PropertyEnumToValueNameLinearTiny4Mapper / PropertyEnumToValueNameLinearTiny4MapperBorrowed; /// Return a [`PropertyEnumToValueNameLinearTiny4Mapper`], capable of looking up long names - /// for values of the `Script` enumerated property + /// for values of the `Script` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1530,7 +1570,11 @@ impl_value_getter! { markers: EastAsianWidthNameToValueV1Marker / SINGLETON_PROPNAMES_FROM_EA_V1, EastAsianWidthValueToShortNameV1Marker / SINGLETON_PROPNAMES_TO_SHORT_LINEAR_EA_V1, EastAsianWidthValueToLongNameV1Marker / SINGLETON_PROPNAMES_TO_LONG_LINEAR_EA_V1; impl EastAsianWidth { /// Return a [`PropertyValueNameToEnumMapper`], capable of looking up values - /// from strings for the `East_Asian_Width` enumerated property + /// from strings for the `East_Asian_Width` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1553,7 +1597,11 @@ impl_value_getter! { /// ``` pub fn get_name_to_enum_mapper() / name_to_enum_mapper(); /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up short names - /// for values of the `East_Asian_Width` enumerated property + /// for values of the `East_Asian_Width` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1566,7 +1614,11 @@ impl_value_getter! { /// ``` pub fn get_enum_to_short_name_mapper() / enum_to_short_name_mapper() -> PropertyEnumToValueNameLinearMapper / PropertyEnumToValueNameLinearMapperBorrowed; /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up long names - /// for values of the `East_Asian_Width` enumerated property + /// for values of the `East_Asian_Width` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1648,7 +1700,11 @@ impl_value_getter! { markers: LineBreakNameToValueV1Marker / SINGLETON_PROPNAMES_FROM_LB_V1, LineBreakValueToShortNameV1Marker / SINGLETON_PROPNAMES_TO_SHORT_LINEAR_LB_V1, LineBreakValueToLongNameV1Marker / SINGLETON_PROPNAMES_TO_LONG_LINEAR_LB_V1; impl LineBreak { /// Return a [`PropertyValueNameToEnumMapper`], capable of looking up values - /// from strings for the `Line_Break` enumerated property + /// from strings for the `Line_Break` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1671,7 +1727,11 @@ impl_value_getter! { /// ``` pub fn get_name_to_enum_mapper() / name_to_enum_mapper(); /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up short names - /// for values of the `Line_Break` enumerated property + /// for values of the `Line_Break` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1684,7 +1744,11 @@ impl_value_getter! { /// ``` pub fn get_enum_to_short_name_mapper() / enum_to_short_name_mapper() -> PropertyEnumToValueNameLinearMapper / PropertyEnumToValueNameLinearMapperBorrowed; /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up long names - /// for values of the `Line_Break` enumerated property + /// for values of the `Line_Break` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1746,7 +1810,11 @@ impl_value_getter! { markers: GraphemeClusterBreakNameToValueV1Marker / SINGLETON_PROPNAMES_FROM_GCB_V1, GraphemeClusterBreakValueToShortNameV1Marker / SINGLETON_PROPNAMES_TO_SHORT_LINEAR_GCB_V1, GraphemeClusterBreakValueToLongNameV1Marker / SINGLETON_PROPNAMES_TO_LONG_LINEAR_GCB_V1; impl GraphemeClusterBreak { /// Return a [`PropertyValueNameToEnumMapper`], capable of looking up values - /// from strings for the `Grapheme_Cluster_Break` enumerated property + /// from strings for the `Grapheme_Cluster_Break` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1769,7 +1837,11 @@ impl_value_getter! { /// ``` pub fn get_name_to_enum_mapper() / name_to_enum_mapper(); /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up short names - /// for values of the `Grapheme_Cluster_Break` enumerated property + /// for values of the `Grapheme_Cluster_Break` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1782,7 +1854,11 @@ impl_value_getter! { /// ``` pub fn get_enum_to_short_name_mapper() / enum_to_short_name_mapper() -> PropertyEnumToValueNameLinearMapper / PropertyEnumToValueNameLinearMapperBorrowed; /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up long names - /// for values of the `Grapheme_Cluster_Break` enumerated property + /// for values of the `Grapheme_Cluster_Break` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1849,7 +1925,11 @@ impl_value_getter! { markers: WordBreakNameToValueV1Marker / SINGLETON_PROPNAMES_FROM_WB_V1, WordBreakValueToShortNameV1Marker / SINGLETON_PROPNAMES_TO_SHORT_LINEAR_WB_V1, WordBreakValueToLongNameV1Marker / SINGLETON_PROPNAMES_TO_LONG_LINEAR_WB_V1; impl WordBreak { /// Return a [`PropertyValueNameToEnumMapper`], capable of looking up values - /// from strings for the `Word_Break` enumerated property + /// from strings for the `Word_Break` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1872,7 +1952,11 @@ impl_value_getter! { /// ``` pub fn get_name_to_enum_mapper() / name_to_enum_mapper(); /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up short names - /// for values of the `Word_Break` enumerated property + /// for values of the `Word_Break` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1885,7 +1969,11 @@ impl_value_getter! { /// ``` pub fn get_enum_to_short_name_mapper() / enum_to_short_name_mapper() -> PropertyEnumToValueNameLinearMapper / PropertyEnumToValueNameLinearMapperBorrowed; /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up long names - /// for values of the `Word_Break` enumerated property + /// for values of the `Word_Break` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1939,7 +2027,11 @@ impl_value_getter! { markers: SentenceBreakNameToValueV1Marker / SINGLETON_PROPNAMES_FROM_SB_V1, SentenceBreakValueToShortNameV1Marker / SINGLETON_PROPNAMES_TO_SHORT_LINEAR_SB_V1, SentenceBreakValueToLongNameV1Marker / SINGLETON_PROPNAMES_TO_LONG_LINEAR_SB_V1; impl SentenceBreak { /// Return a [`PropertyValueNameToEnumMapper`], capable of looking up values - /// from strings for the `Sentence_Break` enumerated property + /// from strings for the `Sentence_Break` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1962,7 +2054,11 @@ impl_value_getter! { /// ``` pub fn get_name_to_enum_mapper() / name_to_enum_mapper(); /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up short names - /// for values of the `Sentence_Break` enumerated property + /// for values of the `Sentence_Break` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -1975,7 +2071,11 @@ impl_value_getter! { /// ``` pub fn get_enum_to_short_name_mapper() / enum_to_short_name_mapper() -> PropertyEnumToValueNameLinearMapper / PropertyEnumToValueNameLinearMapperBorrowed; /// Return a [`PropertyEnumToValueNameLinearMapper`], capable of looking up long names - /// for values of the `Sentence_Break` enumerated property + /// for values of the `Sentence_Break` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -2077,7 +2177,11 @@ impl_value_getter! { markers: CanonicalCombiningClassNameToValueV1Marker / SINGLETON_PROPNAMES_FROM_CCC_V1, CanonicalCombiningClassValueToShortNameV1Marker / SINGLETON_PROPNAMES_TO_SHORT_SPARSE_CCC_V1, CanonicalCombiningClassValueToLongNameV1Marker / SINGLETON_PROPNAMES_TO_LONG_SPARSE_CCC_V1; impl CanonicalCombiningClass { /// Return a [`PropertyValueNameToEnumMapper`], capable of looking up values - /// from strings for the `Canonical_Combining_Class` enumerated property + /// from strings for the `Canonical_Combining_Class` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -2101,7 +2205,11 @@ impl_value_getter! { /// ``` pub fn get_name_to_enum_mapper() / name_to_enum_mapper(); /// Return a [`PropertyEnumToValueNameSparseMapper`], capable of looking up short names - /// for values of the `Canonical_Combining_Class` enumerated property + /// for values of the `Canonical_Combining_Class` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// @@ -2115,7 +2223,11 @@ impl_value_getter! { /// ``` pub fn get_enum_to_short_name_mapper() / enum_to_short_name_mapper() -> PropertyEnumToValueNameSparseMapper / PropertyEnumToValueNameSparseMapperBorrowed; /// Return a [`PropertyEnumToValueNameSparseMapper`], capable of looking up long names - /// for values of the `Canonical_Combining_Class` enumerated property + /// for values of the `Canonical_Combining_Class` enumerated property. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Example /// diff --git a/components/properties/src/script.rs b/components/properties/src/script.rs index 0564a4efc48..9bb64423c6e 100644 --- a/components/properties/src/script.rs +++ b/components/properties/src/script.rs @@ -561,6 +561,10 @@ impl ScriptWithExtensionsBorrowed<'static> { /// Returns a [`ScriptWithExtensionsBorrowed`] struct that represents the data for the Script /// and Script_Extensions properties. /// +/// ✨ *Enabled with the `compiled_data` Cargo feature.* +/// +/// [πŸ“š Help choosing a constructor](icu_provider::constructors) +/// /// # Examples /// /// ``` @@ -612,10 +616,6 @@ impl ScriptWithExtensionsBorrowed<'static> { /// assert!(syriac.contains32(0x0700)); // SYRIAC END OF PARAGRAPH /// assert!(syriac.contains32(0x074A)); // SYRIAC BARREKH /// ``` -/// -/// ✨ *Enabled with the `compiled_data` Cargo feature.* -/// -/// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] pub const fn script_with_extensions() -> ScriptWithExtensionsBorrowed<'static> { ScriptWithExtensionsBorrowed { diff --git a/components/properties/src/sets.rs b/components/properties/src/sets.rs index 7c60fea0639..5ead3f81b24 100644 --- a/components/properties/src/sets.rs +++ b/components/properties/src/sets.rs @@ -340,10 +340,10 @@ macro_rules! make_code_point_set_property { $cvis:vis const fn $constname:ident() => $singleton_name:ident; $vis:vis fn $funcname:ident(); ) => { - #[doc = concat!("[`", stringify!($constname), "()`] with a runtime data provider argument.")] + #[doc = concat!("A version of [`", stringify!($constname), "()`] that uses custom data provided by a [`DataProvider`].")] /// /// Note that this will return an owned version of the data. Functionality is available on - /// the borrowed version, accessible through `.as_borrowed()`. + /// the borrowed version, accessible through [`CodePointSetData::as_borrowed`]. $vis fn $funcname( provider: &(impl DataProvider<$keyed_data_marker> + ?Sized) ) -> Result { @@ -351,8 +351,6 @@ macro_rules! make_code_point_set_property { } $(#[$doc])* - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* #[cfg(feature = "compiled_data")] $cvis const fn $constname() -> CodePointSetDataBorrowed<'static> { CodePointSetDataBorrowed { @@ -369,6 +367,10 @@ make_code_point_set_property! { func: /// ASCII characters commonly used for the representation of hexadecimal numbers /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -404,6 +406,10 @@ make_code_point_set_property! { func: /// Alphabetic characters /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -429,6 +435,10 @@ make_code_point_set_property! { /// Format control characters which have specific functions in the Unicode Bidirectional /// Algorithm /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -451,6 +461,10 @@ make_code_point_set_property! { func: /// Characters that are mirrored in bidirectional text /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -486,6 +500,10 @@ make_code_point_set_property! { func: /// Uppercase, lowercase, and titlecase characters /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -508,6 +526,10 @@ make_code_point_set_property! { func: /// Characters which are ignored for casing purposes /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -542,6 +564,10 @@ make_code_point_set_property! { func: /// Characters whose normalized forms are not stable under case folding /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -575,6 +601,10 @@ make_code_point_set_property! { func: /// Characters which are not identical to their NFKC_Casefold mapping /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -597,6 +627,10 @@ make_code_point_set_property! { func: /// Characters whose normalized forms are not stable under a toLowercase mapping /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -619,6 +653,10 @@ make_code_point_set_property! { func: /// Characters whose normalized forms are not stable under a toTitlecase mapping /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -641,6 +679,10 @@ make_code_point_set_property! { func: /// Characters whose normalized forms are not stable under a toUppercase mapping /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -664,6 +706,10 @@ make_code_point_set_property! { /// Punctuation characters explicitly called out as dashes in the Unicode Standard, plus /// their compatibility equivalents /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -688,6 +734,10 @@ make_code_point_set_property! { /// Deprecated characters. No characters will ever be removed from the standard, but the /// usage of deprecated characters is strongly discouraged. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -713,6 +763,10 @@ make_code_point_set_property! { /// ranges, permitting programs to correctly handle the default rendering of such /// characters when not otherwise supported. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -735,6 +789,10 @@ make_code_point_set_property! { func: /// Characters that linguistically modify the meaning of another character to which they apply /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -757,6 +815,10 @@ make_code_point_set_property! { func: /// Characters that can serve as a base for emoji modifiers /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -780,6 +842,10 @@ make_code_point_set_property! { /// Characters used in emoji sequences that normally do not appear on emoji keyboards as /// separate choices, such as base characters for emoji keycaps /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -804,6 +870,10 @@ make_code_point_set_property! { func: /// Characters that are emoji modifiers /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -826,6 +896,10 @@ make_code_point_set_property! { func: /// Characters that are emoji /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -848,6 +922,10 @@ make_code_point_set_property! { func: /// Characters that have emoji presentation by default /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -871,6 +949,10 @@ make_code_point_set_property! { /// Characters whose principal function is to extend the value of a preceding alphabetic /// character or to extend the shape of adjacent characters. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -895,6 +977,10 @@ make_code_point_set_property! { /// Pictographic symbols, as well as reserved ranges in blocks largely associated with /// emoji characters /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -930,6 +1016,10 @@ make_code_point_set_property! { /// Property used together with the definition of Standard Korean Syllable Block to define /// "Grapheme base". See D58 in Chapter 3, Conformance in the Unicode Standard. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -954,6 +1044,10 @@ make_code_point_set_property! { /// Property used to define "Grapheme extender". See D59 in Chapter 3, Conformance in the /// Unicode Standard. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -990,6 +1084,10 @@ make_code_point_set_property! { /// Characters commonly used for the representation of hexadecimal numbers, plus their /// compatibility equivalents /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1031,6 +1129,10 @@ make_code_point_set_property! { /// [`Unicode Standard Annex #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for /// more details. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1058,6 +1160,10 @@ make_code_point_set_property! { /// Characters considered to be CJKV (Chinese, Japanese, Korean, and Vietnamese) /// ideographs, or related siniform ideographs /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1082,6 +1188,10 @@ make_code_point_set_property! { /// characters, use [`load_xid_start`] instead. See [`Unicode Standard Annex /// #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for more details. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1108,6 +1218,10 @@ make_code_point_set_property! { func: /// Characters used in Ideographic Description Sequences /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1130,6 +1244,10 @@ make_code_point_set_property! { func: /// Characters used in Ideographic Description Sequences /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1156,6 +1274,10 @@ make_code_point_set_property! { /// Format control characters which have specific functions for control of cursive joining /// and ligation /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1179,6 +1301,10 @@ make_code_point_set_property! { func: /// A small number of spacing vowel letters occurring in certain Southeast Asian scripts such as Thai and Lao /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1201,6 +1327,10 @@ make_code_point_set_property! { func: /// Lowercase characters /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1223,6 +1353,10 @@ make_code_point_set_property! { func: /// Characters used in mathematical notation /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1249,6 +1383,10 @@ make_code_point_set_property! { func: /// Code points permanently reserved for internal use /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1318,6 +1456,10 @@ make_code_point_set_property! { /// Standard Annex #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for more /// details. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1343,6 +1485,10 @@ make_code_point_set_property! { /// [`Unicode Standard Annex #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for /// more details. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1391,6 +1537,10 @@ make_code_point_set_property! { func: /// Punctuation characters that function as quotation marks. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1414,6 +1564,10 @@ make_code_point_set_property! { func: /// Characters used in the definition of Ideographic Description Sequences /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1436,6 +1590,10 @@ make_code_point_set_property! { func: /// Regional indicator characters, U+1F1E6..U+1F1FF /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1460,6 +1618,10 @@ make_code_point_set_property! { /// Characters with a "soft dot", like i or j. An accent placed on these characters causes /// the dot to disappear. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1506,6 +1668,10 @@ make_code_point_set_property! { func: /// Punctuation characters that generally mark the end of sentences /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1531,6 +1697,10 @@ make_code_point_set_property! { func: /// Punctuation characters that generally mark the end of textual units /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1556,6 +1726,10 @@ make_code_point_set_property! { func: /// A property which specifies the exact set of Unified CJK Ideographs in the standard /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1579,6 +1753,10 @@ make_code_point_set_property! { func: /// Uppercase characters /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1601,6 +1779,10 @@ make_code_point_set_property! { func: /// Characters that are Variation Selectors. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1627,6 +1809,10 @@ make_code_point_set_property! { /// Spaces, separator characters and other control characters which should be treated by /// programming languages as "white space" for the purpose of parsing elements /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1664,6 +1850,10 @@ make_code_point_set_property! { /// Characters that can come after the first character in an identifier. See [`Unicode Standard Annex /// #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for more details. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1692,6 +1882,10 @@ make_code_point_set_property! { /// Standard Annex #31`](https://www.unicode.org/reports/tr31/tr31-35.html) for more /// details. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1728,15 +1922,13 @@ macro_rules! make_unicode_set_property { $cvis:vis const fn $constname:ident() => $singleton:ident; $vis:vis fn $funcname:ident(); ) => { - #[doc = concat!("[`", stringify!($constname), "()`] with a runtime data provider argument.")] + #[doc = concat!("A version of [`", stringify!($constname), "()`] that uses custom data provided by a [`DataProvider`].")] $vis fn $funcname( provider: &(impl DataProvider<$keyed_data_marker> + ?Sized) ) -> Result { Ok(provider.load(Default::default()).and_then(DataResponse::take_payload).map(UnicodeSetData::from_data)?) } $(#[$doc])* - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* #[cfg(feature = "compiled_data")] $cvis const fn $constname() -> UnicodeSetDataBorrowed<'static> { UnicodeSetDataBorrowed { @@ -1755,6 +1947,10 @@ make_unicode_set_property! { /// See [`Unicode Technical Standard #51`](https://unicode.org/reports/tr51/) for more /// details. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Example /// /// ``` @@ -1777,7 +1973,9 @@ make_unicode_set_property! { // Enumerated property getter fns // -/// Return a [`CodePointSetData`] for a value or a grouping of values of the General_Category property. See [`GeneralCategoryGroup`]. +/// A version of [`for_general_category_group()`] that uses custom data provided by a [`DataProvider`]. +/// +/// [πŸ“š Help choosing a constructor](icu_provider::constructors) pub fn load_for_general_category_group( provider: &(impl DataProvider + ?Sized), enum_val: GeneralCategoryGroup, @@ -1793,6 +1991,10 @@ pub fn load_for_general_category_group( } /// Return a [`CodePointSetData`] for a value or a grouping of values of the General_Category property. See [`GeneralCategoryGroup`]. +/// +/// ✨ *Enabled with the `compiled_data` Cargo feature.* +/// +/// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] pub fn for_general_category_group(enum_val: GeneralCategoryGroup) -> CodePointSetData { let matching_gc_ranges = maps::general_category() @@ -1822,7 +2024,11 @@ pub fn for_general_category_group(enum_val: GeneralCategoryGroup) -> CodePointSe /// - `General_Category` property values can themselves be treated like properties using a shorthand in ECMA262, /// simply create the corresponding `GeneralCategory` set. /// -/// ```rust +/// ✨ *Enabled with the `compiled_data` Cargo feature.* +/// +/// [πŸ“š Help choosing a constructor](icu_provider::constructors) +/// +/// ``` /// use icu::properties::sets; /// /// let emoji = sets::load_for_ecma262("Emoji") diff --git a/components/segmenter/src/grapheme.rs b/components/segmenter/src/grapheme.rs index 26bd6835159..07aad2d7a5a 100644 --- a/components/segmenter/src/grapheme.rs +++ b/components/segmenter/src/grapheme.rs @@ -141,7 +141,7 @@ impl Default for GraphemeClusterSegmenter { } impl GraphemeClusterSegmenter { - /// Constructs a [`GraphemeClusterSegmenter`] with an invariant locale. + /// Constructs a [`GraphemeClusterSegmenter`] with an invariant locale from compiled data. /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// diff --git a/components/segmenter/src/line.rs b/components/segmenter/src/line.rs index 52967f8abe6..2c66be3dcdb 100644 --- a/components/segmenter/src/line.rs +++ b/components/segmenter/src/line.rs @@ -235,7 +235,7 @@ pub struct LineSegmenter { } impl LineSegmenter { - /// Constructs a [`LineSegmenter`] with an invariant locale and the best available data for + /// Constructs a [`LineSegmenter`] with an invariant locale and the best available compiled data for /// complex scripts (Khmer, Lao, Myanmar, and Thai). /// /// The current behavior, which is subject to change, is to use the LSTM model when available. @@ -278,7 +278,7 @@ impl LineSegmenter { Self::try_new_auto_with_options_unstable(provider, Default::default()) } - /// Constructs a [`LineSegmenter`] with an invariant locale and LSTM data for + /// Constructs a [`LineSegmenter`] with an invariant locale and compiled LSTM data for /// complex scripts (Khmer, Lao, Myanmar, and Thai). /// /// The LSTM, or Long Term Short Memory, is a machine learning model. It is smaller than @@ -322,7 +322,7 @@ impl LineSegmenter { Self::try_new_lstm_with_options_unstable(provider, Default::default()) } - /// Constructs a [`LineSegmenter`] with an invariant locale and dictionary data for + /// Constructs a [`LineSegmenter`] with an invariant locale and compiled dictionary data for /// complex scripts (Khmer, Lao, Myanmar, and Thai). /// /// The dictionary model uses a list of words to determine appropriate breakpoints. It is @@ -364,7 +364,7 @@ impl LineSegmenter { } /// Constructs a [`LineSegmenter`] with an invariant locale, custom [`LineBreakOptions`], and - /// the best available data for complex scripts (Khmer, Lao, Myanmar, and Thai). + /// the best available compiled data for complex scripts (Khmer, Lao, Myanmar, and Thai). /// /// The current behavior, which is subject to change, is to use the LSTM model when available. /// @@ -410,7 +410,7 @@ impl LineSegmenter { } /// Constructs a [`LineSegmenter`] with an invariant locale, custom [`LineBreakOptions`], and - /// LSTM data for complex scripts (Khmer, Lao, Myanmar, and Thai). + /// compiled LSTM data for complex scripts (Khmer, Lao, Myanmar, and Thai). /// /// The LSTM, or Long Term Short Memory, is a machine learning model. It is smaller than /// the full dictionary but more expensive during segmentation (inference). @@ -467,7 +467,7 @@ impl LineSegmenter { } /// Constructs a [`LineSegmenter`] with an invariant locale, custom [`LineBreakOptions`], and - /// dictionary data for complex scripts (Khmer, Lao, Myanmar, and Thai). + /// compiled dictionary data for complex scripts (Khmer, Lao, Myanmar, and Thai). /// /// The dictionary model uses a list of words to determine appropriate breakpoints. It is /// faster than the LSTM model but requires more data. diff --git a/components/segmenter/src/sentence.rs b/components/segmenter/src/sentence.rs index 49b6c4bdf82..05173f9eb5f 100644 --- a/components/segmenter/src/sentence.rs +++ b/components/segmenter/src/sentence.rs @@ -110,7 +110,7 @@ impl Default for SentenceSegmenter { } impl SentenceSegmenter { - /// Constructs a [`SentenceSegmenter`] with an invariant locale. + /// Constructs a [`SentenceSegmenter`] with an invariant locale and compiled data. /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// diff --git a/components/segmenter/src/word.rs b/components/segmenter/src/word.rs index 734d9db40c9..e656bf41ebf 100644 --- a/components/segmenter/src/word.rs +++ b/components/segmenter/src/word.rs @@ -156,12 +156,16 @@ pub struct WordSegmenter { } impl WordSegmenter { - /// Constructs a [`WordSegmenter`] with an invariant locale and the best available data for + /// Constructs a [`WordSegmenter`] with an invariant locale and the best available compiled data for /// complex scripts (Chinese, Japanese, Khmer, Lao, Myanmar, and Thai). /// /// The current behavior, which is subject to change, is to use the LSTM model when available /// and the dictionary model for Chinese and Japanese. /// + /// ✨ *Enabled with the `compiled_data` and `auto` Cargo features.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// Behavior with complex scripts: @@ -180,10 +184,6 @@ impl WordSegmenter { /// assert_eq!(th_bps, [0, 9, 18, 39]); /// assert_eq!(ja_bps, [0, 15, 21]); /// ``` - /// - /// ✨ *Enabled with the `compiled_data` and `auto` Cargo features.* - /// - /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] #[cfg(feature = "auto")] pub fn new_auto() -> Self { @@ -226,7 +226,7 @@ impl WordSegmenter { }) } - /// Constructs a [`WordSegmenter`] with an invariant locale and LSTM data for + /// Constructs a [`WordSegmenter`] with an invariant locale and compiled LSTM data for /// complex scripts (Burmese, Khmer, Lao, and Thai). /// /// The LSTM, or Long Term Short Memory, is a machine learning model. It is smaller than @@ -237,6 +237,8 @@ impl WordSegmenter { /// /// ✨ *Enabled with the `compiled_data` and `lstm` Cargo features.* /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// Behavior with complex scripts: @@ -257,8 +259,6 @@ impl WordSegmenter { /// // Note: We aren't able to find a suitable breakpoint in Chinese/Japanese. /// assert_eq!(ja_bps, [0, 21]); /// ``` - /// - /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] #[cfg(feature = "lstm")] pub fn new_lstm() -> Self { @@ -300,7 +300,7 @@ impl WordSegmenter { }) } - /// Construct a [`WordSegmenter`] with an invariant locale and dictionary data for + /// Construct a [`WordSegmenter`] with an invariant locale and compiled dictionary data for /// complex scripts (Chinese, Japanese, Khmer, Lao, Myanmar, and Thai). /// /// The dictionary model uses a list of words to determine appropriate breakpoints. It is @@ -308,6 +308,8 @@ impl WordSegmenter { /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// Behavior with complex scripts: @@ -326,8 +328,6 @@ impl WordSegmenter { /// assert_eq!(th_bps, [0, 9, 18, 39]); /// assert_eq!(ja_bps, [0, 15, 21]); /// ``` - /// - /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] pub fn new_dictionary() -> Self { Self { diff --git a/components/timezone/src/metazone.rs b/components/timezone/src/metazone.rs index b7a9a1c0fae..d4d518a0bf2 100644 --- a/components/timezone/src/metazone.rs +++ b/components/timezone/src/metazone.rs @@ -27,7 +27,7 @@ impl Default for MetazoneCalculator { } impl MetazoneCalculator { - /// Constructs a `MetazoneCalculator`. + /// Constructs a `MetazoneCalculator` using compiled data. /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// diff --git a/docs/tutorials/data_provider.md b/docs/tutorials/data_provider.md index 4e897632346..07a59c4f858 100644 --- a/docs/tutorials/data_provider.md +++ b/docs/tutorials/data_provider.md @@ -48,9 +48,9 @@ pub struct AdditiveIdentity(char); impl AdditiveIdentity { pub fn try_new, P: DataProvider>( locale: L, - data_provider: &P, + provider: &P, ) -> Result { - let response = data_provider.load(DataRequest { + let response = provider.load(DataRequest { locale: &locale.into().into(), metadata: Default::default(), })?.take_payload()?; diff --git a/experimental/casemap/src/casemapper.rs b/experimental/casemap/src/casemapper.rs index b5f847fd81e..38d297e082a 100644 --- a/experimental/casemap/src/casemapper.rs +++ b/experimental/casemap/src/casemapper.rs @@ -51,7 +51,11 @@ impl AsRef for CaseMapper { } impl CaseMapper { - /// A constructor which creates a [`CaseMapper`]. + /// Creates a [`CaseMapper`] using compiled data. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) /// /// # Examples /// @@ -63,10 +67,6 @@ impl CaseMapper { /// /// assert_eq!(cm.uppercase_to_string("hello world", &langid!("und")), "HELLO WORLD"); /// ``` - /// - /// ✨ *Enabled with the `compiled_data` Cargo feature.* - /// - /// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] pub const fn new() -> Self { Self { @@ -549,7 +549,6 @@ impl CaseMapper { } #[cfg(test)] -#[cfg(feature = "compiled_data")] mod tests { use super::*; use icu_locid::langid; diff --git a/experimental/compactdecimal/src/compactdecimal.rs b/experimental/compactdecimal/src/compactdecimal.rs index 26fbd5ebeb5..78658fe85ba 100644 --- a/experimental/compactdecimal/src/compactdecimal.rs +++ b/experimental/compactdecimal/src/compactdecimal.rs @@ -99,9 +99,13 @@ pub struct CompactDecimalFormatter { impl CompactDecimalFormatter { /// Constructor that takes a selected locale and a list of preferences, - /// then collects all data necessary to format numbers in short compact + /// then collects all compiled data necessary to format numbers in short compact /// decimal notation for the given locale. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` @@ -140,7 +144,7 @@ impl CompactDecimalFormatter { locale: include, options: CompactDecimalFormatterOptions, error: CompactDecimalError, - #[cfg(skip_new)] + #[cfg(skip)] functions: [ try_new_short, try_new_short_with_any_provider, @@ -152,7 +156,7 @@ impl CompactDecimalFormatter { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new_short)] pub fn try_new_short_unstable( - data_provider: &D, + provider: &D, locale: &DataLocale, options: CompactDecimalFormatterOptions, ) -> Result @@ -164,13 +168,13 @@ impl CompactDecimalFormatter { { Ok(Self { fixed_decimal_format: FixedDecimalFormatter::try_new_unstable( - data_provider, + provider, locale, options.fixed_decimal_formatter_options, )?, - plural_rules: PluralRules::try_new_cardinal_unstable(data_provider, locale)?, + plural_rules: PluralRules::try_new_cardinal_unstable(provider, locale)?, compact_data: DataProvider::::load( - data_provider, + provider, DataRequest { locale, metadata: Default::default(), @@ -182,9 +186,13 @@ impl CompactDecimalFormatter { } /// Constructor that takes a selected locale and a list of preferences, - /// then collects all data necessary to format numbers in short compact + /// then collects all compiled data necessary to format numbers in short compact /// decimal notation for the given locale. /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) + /// /// # Examples /// /// ``` @@ -235,7 +243,7 @@ impl CompactDecimalFormatter { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new_long)] pub fn try_new_long_unstable( - data_provider: &D, + provider: &D, locale: &DataLocale, options: CompactDecimalFormatterOptions, ) -> Result @@ -247,13 +255,13 @@ impl CompactDecimalFormatter { { Ok(Self { fixed_decimal_format: FixedDecimalFormatter::try_new_unstable( - data_provider, + provider, locale, options.fixed_decimal_formatter_options, )?, - plural_rules: PluralRules::try_new_cardinal_unstable(data_provider, locale)?, + plural_rules: PluralRules::try_new_cardinal_unstable(provider, locale)?, compact_data: DataProvider::::load( - data_provider, + provider, DataRequest { locale, metadata: Default::default(), diff --git a/experimental/displaynames/src/displaynames.rs b/experimental/displaynames/src/displaynames.rs index 8adcd3278b3..e7c19298a5b 100644 --- a/experimental/displaynames/src/displaynames.rs +++ b/experimental/displaynames/src/displaynames.rs @@ -39,7 +39,11 @@ impl RegionDisplayNames { locale: include, options: DisplayNamesOptions, error: DataError, - /// Creates a new [`RegionDisplayNames`] from locale data and an options bag. + /// Creates a new [`RegionDisplayNames`] from locale data and an options bag using compiled data. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) functions: [ try_new, try_new_with_any_provider, @@ -51,11 +55,11 @@ impl RegionDisplayNames { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new)] pub fn try_new_unstable + ?Sized>( - data_provider: &D, + provider: &D, locale: &DataLocale, options: DisplayNamesOptions, ) -> Result { - let region_data = data_provider + let region_data = provider .load(DataRequest { locale, metadata: Default::default(), @@ -112,7 +116,11 @@ impl ScriptDisplayNames { locale: include, options: DisplayNamesOptions, error: DataError, - /// Creates a new [`ScriptDisplayNames`] from locale data and an options bag. + /// Creates a new [`ScriptDisplayNames`] from locale data and an options bag using compiled data. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) functions: [ try_new, try_new_with_any_provider, @@ -124,11 +132,11 @@ impl ScriptDisplayNames { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new)] pub fn try_new_unstable + ?Sized>( - data_provider: &D, + provider: &D, locale: &DataLocale, options: DisplayNamesOptions, ) -> Result { - let script_data = data_provider + let script_data = provider .load(DataRequest { locale, metadata: Default::default(), @@ -186,7 +194,11 @@ impl VariantDisplayNames { locale: include, options: DisplayNamesOptions, error: DataError, - /// Creates a new [`VariantDisplayNames`] from locale data and an options bag. + /// Creates a new [`VariantDisplayNames`] from locale data and an options bag using compiled data. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) functions: [ try_new, try_new_with_any_provider, @@ -198,11 +210,11 @@ impl VariantDisplayNames { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new)] pub fn try_new_unstable + ?Sized>( - data_provider: &D, + provider: &D, locale: &DataLocale, options: DisplayNamesOptions, ) -> Result { - let variant_data = data_provider + let variant_data = provider .load(DataRequest { locale, metadata: Default::default(), @@ -252,7 +264,11 @@ impl LanguageDisplayNames { locale: include, options: DisplayNamesOptions, error: DataError, - /// Creates a new [`LanguageDisplayNames`] from locale data and an options bag. + /// Creates a new [`LanguageDisplayNames`] from locale data and an options bag using compiled data. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) functions: [ try_new, try_new_with_any_provider, @@ -264,11 +280,11 @@ impl LanguageDisplayNames { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new)] pub fn try_new_unstable + ?Sized>( - data_provider: &D, + provider: &D, locale: &DataLocale, options: DisplayNamesOptions, ) -> Result { - let language_data = data_provider + let language_data = provider .load(DataRequest { locale, metadata: Default::default(), @@ -345,7 +361,11 @@ impl LocaleDisplayNamesFormatter { locale: include, options: DisplayNamesOptions, error: DataError, - /// Creates a new [`LocaleDisplayNamesFormatter`] from locale data and an options bag. + /// Creates a new [`LocaleDisplayNamesFormatter`] from locale data and an options bag using compiled data. + /// + /// ✨ *Enabled with the `compiled_data` Cargo feature.* + /// + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) functions: [ try_new, try_new_with_any_provider, @@ -357,7 +377,7 @@ impl LocaleDisplayNamesFormatter { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new)] pub fn try_new_unstable( - data_provider: &D, + provider: &D, locale: &DataLocale, options: DisplayNamesOptions, ) -> Result @@ -375,11 +395,11 @@ impl LocaleDisplayNamesFormatter { Ok(Self { options, - language_data: data_provider.load(req)?.take_payload()?, - locale_data: data_provider.load(req)?.take_payload()?, - script_data: data_provider.load(req)?.take_payload()?, - region_data: data_provider.load(req)?.take_payload()?, - variant_data: data_provider.load(req)?.take_payload()?, + language_data: provider.load(req)?.take_payload()?, + locale_data: provider.load(req)?.take_payload()?, + script_data: provider.load(req)?.take_payload()?, + region_data: provider.load(req)?.take_payload()?, + variant_data: provider.load(req)?.take_payload()?, }) } diff --git a/experimental/harfbuzz/src/lib.rs b/experimental/harfbuzz/src/lib.rs index 884f54efa6f..9a8054dfc59 100644 --- a/experimental/harfbuzz/src/lib.rs +++ b/experimental/harfbuzz/src/lib.rs @@ -325,9 +325,13 @@ impl Drop for UnicodeFuncs { } } -/// Sets up a `hb_unicode_funcs_t` with ICU4X as the back end as the Unicode +/// Sets up a `hb_unicode_funcs_t` with ICU4X compiled data as the back end as the Unicode /// Database operations that HarfBuzz needs. The `hb_unicode_funcs_t` held /// by the returned `UnicodeFuncs` is marked immutable. +/// +/// ✨ *Enabled with the `compiled_data` Cargo feature.* +/// +/// [πŸ“š Help choosing a constructor](icu_provider::constructors) #[cfg(feature = "compiled_data")] pub fn new_hb_unicode_funcs() -> Result { create_ufuncs( @@ -342,7 +346,7 @@ pub fn new_hb_unicode_funcs() -> Result { } #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, new_hb_unicode_funcs)] -pub fn new_hb_unicode_funcs_unstable(data_provider: &D) -> Result +pub fn new_hb_unicode_funcs_unstable(provider: &D) -> Result where D: DataProvider + DataProvider @@ -355,13 +359,13 @@ where + ?Sized, { create_ufuncs( - CanonicalCombiningClassMap::try_new_unstable(data_provider)?, - icu_properties::maps::load_general_category(data_provider)?, - icu_properties::bidi_data::load_bidi_auxiliary_properties_unstable(data_provider)?, - icu_properties::maps::load_script(data_provider)?, - Script::get_enum_to_short_name_mapper(data_provider)?, - CanonicalComposition::try_new_unstable(data_provider)?, - CanonicalDecomposition::try_new_unstable(data_provider)?, + CanonicalCombiningClassMap::try_new_unstable(provider)?, + icu_properties::maps::load_general_category(provider)?, + icu_properties::bidi_data::load_bidi_auxiliary_properties_unstable(provider)?, + icu_properties::maps::load_script(provider)?, + Script::get_enum_to_short_name_mapper(provider)?, + CanonicalComposition::try_new_unstable(provider)?, + CanonicalDecomposition::try_new_unstable(provider)?, ) } diff --git a/experimental/personnames/src/formatter.rs b/experimental/personnames/src/formatter.rs index 047c5955b98..6311d1c01a6 100644 --- a/experimental/personnames/src/formatter.rs +++ b/experimental/personnames/src/formatter.rs @@ -15,14 +15,14 @@ pub struct PersonNamesFormatter { impl PersonNamesFormatter { pub fn try_new_unstable>( - data_provider: &D, + provider: &D, locale: &DataLocale, options: PersonNamesFormatterOptions, ) -> Result where D: DataProvider, { - let data_payload = data_provider + let data_payload = provider .load(DataRequest { locale, metadata: Default::default(), diff --git a/experimental/relativetime/src/relativetime.rs b/experimental/relativetime/src/relativetime.rs index 7a54cc900c3..a830b2c7d02 100644 --- a/experimental/relativetime/src/relativetime.rs +++ b/experimental/relativetime/src/relativetime.rs @@ -116,7 +116,7 @@ pub struct RelativeTimeFormatter { macro_rules! constructor { ($unstable: ident, $baked: ident, $any: ident, $buffer: ident, $marker: ty) => { - /// Create a new [`RelativeTimeFormatter`] + /// Create a new [`RelativeTimeFormatter`] from compiled data. /// /// ✨ *Enabled with the `compiled_data` Cargo feature.* /// @@ -164,7 +164,7 @@ macro_rules! constructor { #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::$baked)] pub fn $unstable( - data_provider: &D, + provider: &D, locale: &DataLocale, options: RelativeTimeFormatterOptions, ) -> Result @@ -174,14 +174,14 @@ macro_rules! constructor { + DataProvider + ?Sized, { - let plural_rules = PluralRules::try_new_cardinal_unstable(data_provider, locale)?; + let plural_rules = PluralRules::try_new_cardinal_unstable(provider, locale)?; // Initialize FixedDecimalFormatter with default options let fixed_decimal_format = FixedDecimalFormatter::try_new_unstable( - data_provider, + provider, locale, FixedDecimalFormatterOptions::default(), )?; - let rt: DataPayload<$marker> = data_provider + let rt: DataPayload<$marker> = provider .load(DataRequest { locale, metadata: Default::default(), diff --git a/experimental/unicodeset_parser/src/parse.rs b/experimental/unicodeset_parser/src/parse.rs index f1bd73e3fd0..13ce89c58bd 100644 --- a/experimental/unicodeset_parser/src/parse.rs +++ b/experimental/unicodeset_parser/src/parse.rs @@ -1297,6 +1297,10 @@ where /// `General_Category` property. /// * We do not support `\N{Unicode code point name}` character escaping. Use any other escape method described in UTS35. /// +/// ✨ *Enabled with the `compiled_data` Cargo feature.* +/// +/// [πŸ“š Help choosing a constructor](icu_provider::constructors) +/// /// # Examples /// /// Parse ranges diff --git a/provider/adapters/src/fork/mod.rs b/provider/adapters/src/fork/mod.rs index f72a735a8d0..a15c742c60a 100644 --- a/provider/adapters/src/fork/mod.rs +++ b/provider/adapters/src/fork/mod.rs @@ -80,9 +80,9 @@ use predicates::MissingDataKeyPredicate; /// HelloWorldProvider.into_json_provider(), /// ); /// -/// let data_provider = forking_provider.as_deserializing(); +/// let provider = forking_provider.as_deserializing(); /// -/// let german_hello_world: DataPayload = data_provider +/// let german_hello_world: DataPayload = provider /// .load(DataRequest { /// locale: &locale!("de").into(), /// metadata: Default::default(), @@ -114,11 +114,11 @@ use predicates::MissingDataKeyPredicate; /// .filter_by_langid(|langid| langid.language == language!("de")), /// ); /// -/// let data_provider: &dyn DataProvider = +/// let provider: &dyn DataProvider = /// &forking_provider.as_deserializing(); /// /// // Chinese is the first provider, so this succeeds -/// let chinese_hello_world = data_provider +/// let chinese_hello_world = provider /// .load(DataRequest { /// locale: &locale!("zh").into(), /// metadata: Default::default(), @@ -130,7 +130,7 @@ use predicates::MissingDataKeyPredicate; /// assert_eq!("δ½ ε₯½δΈ–η•Œ", chinese_hello_world.get().message); /// /// // German is shadowed by Chinese, so this fails -/// data_provider +/// provider /// .load(DataRequest { /// locale: &locale!("de").into(), /// metadata: Default::default(), @@ -185,11 +185,11 @@ impl ForkByKeyProvider { /// ], /// ); /// -/// let data_provider: &dyn DataProvider = +/// let provider: &dyn DataProvider = /// &forking_provider.as_deserializing(); /// /// // Chinese is the first provider, so this succeeds -/// let chinese_hello_world = data_provider +/// let chinese_hello_world = provider /// .load(DataRequest { /// locale: &locale!("zh").into(), /// metadata: Default::default(), @@ -201,7 +201,7 @@ impl ForkByKeyProvider { /// assert_eq!("δ½ ε₯½δΈ–η•Œ", chinese_hello_world.get().message); /// /// // German is shadowed by Chinese, so this fails -/// data_provider +/// provider /// .load(DataRequest { /// locale: &locale!("de").into(), /// metadata: Default::default(), diff --git a/provider/core/src/constructors.rs b/provider/core/src/constructors.rs index 0c13cae5598..5b5d487b214 100644 --- a/provider/core/src/constructors.rs +++ b/provider/core/src/constructors.rs @@ -118,23 +118,23 @@ macro_rules! gen_any_buffer_unstable_docs { (ANY, $data:path) => { concat!( "A version of [`", stringify!($data), "`] that uses custom data ", - "provided by an [`AnyProvider`](", stringify!($crate), "::AnyProvider).\n\n", - "[πŸ“š Help choosing a constructor](", stringify!($crate), "::constructors)", + "provided by an [`AnyProvider`](icu_provider::AnyProvider).\n\n", + "[πŸ“š Help choosing a constructor](icu_provider::constructors)", ) }; (BUFFER, $data:path) => { concat!( "A version of [`", stringify!($data), "`] that uses custom data ", - "provided by a [`BufferProvider`](", stringify!($crate), "::BufferProvider).\n\n", - "✨ *Enabled with the `serde` Cargo feature.*\n\n", - "[πŸ“š Help choosing a constructor](", stringify!($crate), "::constructors)", + "provided by a [`BufferProvider`](icu_provider::BufferProvider).\n\n", + "✨ *Enabled with the `serde` feature.*\n\n", + "[πŸ“š Help choosing a constructor](icu_provider::constructors)", ) }; (UNSTABLE, $data:path) => { concat!( "A version of [`", stringify!($data), "`] that uses custom data ", - "provided by a [`DataProvider`](", stringify!($crate), "::DataProvider).\n\n", - "[πŸ“š Help choosing a constructor](", stringify!($crate), "::constructors)\n\n", + "provided by a [`DataProvider`](icu_provider::DataProvider).\n\n", + "[πŸ“š Help choosing a constructor](icu_provider::constructors)\n\n", "
⚠️ The bounds on provider may change over time, including in SemVer minor releases.
" ) }; @@ -162,9 +162,6 @@ macro_rules! gen_any_buffer_data_constructors { (locale: skip, options: skip, error: $error_ty:path, $(#[$doc:meta])+ functions: [$baked:ident, $any:ident, $buffer:ident, $unstable:ident $(, $struct:ident)? $(,)?]) => { #[cfg(feature = "compiled_data")] $(#[$doc])+ - /// ✨ *Enabled with the `compiled_data` Cargo feature.* - /// - /// [πŸ“š Help choosing a constructor](icu_provider::constructors) pub fn $baked() -> Result { $($struct :: )? $unstable(&crate::provider::Baked) } diff --git a/provider/core/src/hello_world.rs b/provider/core/src/hello_world.rs index edc465b0365..aaa86b15e46 100644 --- a/provider/core/src/hello_world.rs +++ b/provider/core/src/hello_world.rs @@ -6,6 +6,8 @@ #![allow(clippy::exhaustive_structs)] // data struct module +use crate as icu_provider; + use crate::prelude::*; use alloc::borrow::Cow; use alloc::string::String; @@ -48,7 +50,7 @@ impl DataMarker for HelloWorldV1Marker { } impl KeyedDataMarker for HelloWorldV1Marker { - const KEY: DataKey = crate::data_key!("core/helloworld@1"); + const KEY: DataKey = icu_provider::data_key!("core/helloworld@1"); } /// A data provider returning Hello World strings in different languages. @@ -131,7 +133,7 @@ impl DataPayload { // AnyProvider support. #[cfg(not(feature = "datagen"))] -crate::impl_dynamic_data_provider!(HelloWorldProvider, [HelloWorldV1Marker,], AnyMarker); +icu_provider::impl_dynamic_data_provider!(HelloWorldProvider, [HelloWorldV1Marker,], AnyMarker); #[cfg(feature = "deserialize_json")] /// A data provider returning Hello World strings in different languages as JSON blobs. @@ -170,7 +172,7 @@ impl BufferProvider for HelloWorldJsonProvider { let result = HelloWorldProvider.load(req)?; let (mut metadata, old_payload) = DataResponse::::take_metadata_and_payload(result)?; - metadata.buffer_format = Some(crate::buf::BufferFormat::Json); + metadata.buffer_format = Some(icu_provider::buf::BufferFormat::Json); #[allow(clippy::unwrap_used)] // HelloWorldV1::serialize is infallible Ok(DataResponse { metadata, @@ -185,7 +187,7 @@ impl BufferProvider for HelloWorldJsonProvider { } #[cfg(feature = "datagen")] -impl crate::datagen::IterableDataProvider for HelloWorldProvider { +impl icu_provider::datagen::IterableDataProvider for HelloWorldProvider { fn supported_locales(&self) -> Result, DataError> { #[allow(clippy::unwrap_used)] // datagen Ok(Self::DATA @@ -197,7 +199,7 @@ impl crate::datagen::IterableDataProvider for HelloWorldProv } #[cfg(feature = "datagen")] -crate::make_exportable_provider!(HelloWorldProvider, [HelloWorldV1Marker,]); +icu_provider::make_exportable_provider!(HelloWorldProvider, [HelloWorldV1Marker,]); /// A type that formats localized "hello world" strings. /// @@ -234,13 +236,13 @@ pub struct FormattedHelloWorld<'l> { impl HelloWorldFormatter { /// Creates a new [`HelloWorldFormatter`] for the specified locale. /// - /// [πŸ“š Help choosing a constructor](crate::constructors) + /// [πŸ“š Help choosing a constructor](icu_provider::constructors) pub fn try_new(locale: &DataLocale) -> Result { Self::try_new_unstable(&HelloWorldProvider, locale) } - crate::gen_any_buffer_data_constructors!(locale: include, options: skip, error: DataError, - #[cfg(skip_new)] + icu_provider::gen_any_buffer_data_constructors!(locale: include, options: skip, error: DataError, + #[cfg(skip)] functions: [ try_new, try_new_with_any_provider, @@ -249,7 +251,7 @@ impl HelloWorldFormatter { Self, ]); - #[doc = crate::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new)] + #[doc = icu_provider::gen_any_buffer_unstable_docs!(UNSTABLE, Self::try_new)] pub fn try_new_unstable

(provider: &P, locale: &DataLocale) -> Result where P: DataProvider,