Skip to content

Commit e000bcc

Browse files
Moving baked provider into provider modules (#3517)
1 parent 27b2af2 commit e000bcc

File tree

6 files changed

+28
-26
lines changed

6 files changed

+28
-26
lines changed

components/plurals/src/lib.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,6 @@ mod operands;
8383
pub mod provider;
8484
pub mod rules;
8585

86-
#[doc(hidden)]
87-
#[cfg(feature = "data")]
88-
pub mod data {
89-
use crate as icu_plurals;
90-
pub(crate) struct Provider;
91-
icu_plurals_data::impl_plurals_ordinal_v1!(Provider);
92-
icu_plurals_data::impl_plurals_cardinal_v1!(Provider);
93-
}
94-
9586
use core::cmp::{Ord, PartialOrd};
9687
pub use error::PluralsError;
9788
use icu_provider::prelude::*;

components/plurals/src/provider.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ use crate::rules::runtime::ast::Rule;
1919
use icu_provider::prelude::*;
2020
use icu_provider::DataMarker;
2121

22+
#[cfg(feature = "data")]
23+
pub(crate) struct Baked;
24+
25+
#[cfg(feature = "data")]
26+
const _: () = {
27+
use crate as icu_plurals;
28+
icu_plurals_data::impl_plurals_ordinal_v1!(Baked);
29+
icu_plurals_data::impl_plurals_cardinal_v1!(Baked);
30+
};
31+
2232
#[cfg(doc)]
2333
use crate::PluralCategory;
2434

components/timezone/src/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,3 @@ pub use types::{GmtOffset, ZoneVariant};
134134

135135
#[doc(no_inline)]
136136
pub use TimeZoneError as Error;
137-
138-
#[cfg(feature = "data")]
139-
#[doc(hidden)]
140-
pub mod data {
141-
use crate as icu_timezone;
142-
pub(crate) struct Provider;
143-
icu_timezone_data::impl_time_zone_metazone_period_v1!(Provider);
144-
}

components/timezone/src/metazone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl MetazoneCalculator {
3737
pub const fn new() -> Self {
3838
MetazoneCalculator {
3939
metazone_period: DataPayload::from_static_ref(
40-
crate::data::Provider::SINGLETON_TIME_ZONE_METAZONE_PERIOD_V1,
40+
crate::provider::Baked::SINGLETON_TIME_ZONE_METAZONE_PERIOD_V1,
4141
),
4242
}
4343
}

components/timezone/src/provider.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ use tinystr::TinyAsciiStr;
2121
use zerovec::ule::{AsULE, ULE};
2222
use zerovec::{ZeroMap2d, ZeroSlice, ZeroVec};
2323

24+
#[cfg(feature = "data")]
25+
pub(crate) struct Baked;
26+
27+
#[cfg(feature = "data")]
28+
const _: () = {
29+
use crate as icu_timezone;
30+
icu_timezone_data::impl_time_zone_metazone_period_v1!(Baked);
31+
};
32+
2433
/// TimeZone ID in BCP47 format
2534
///
2635
/// <div class="stab unstable">

provider/core/src/constructors.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ macro_rules! gen_any_buffer_unstable_docs {
140140
};
141141
}
142142

143-
#[allow(clippy::crate_in_macro_def)] // by convention each crate's data provider is `crate::data::Provider`
143+
#[allow(clippy::crate_in_macro_def)] // by convention each crate's data provider is `crate::provider::Baked`
144144
#[doc(hidden)]
145145
#[macro_export]
146146
macro_rules! gen_any_buffer_data_constructors {
@@ -166,7 +166,7 @@ macro_rules! gen_any_buffer_data_constructors {
166166
///
167167
/// [📚 Help choosing a constructor](icu_provider::constructors)
168168
pub fn $baked() -> Result<Self, $error_ty> {
169-
$($struct :: )? $unstable(&crate::data::Provider)
169+
$($struct :: )? $unstable(&crate::provider::Baked)
170170
}
171171
#[doc = $crate::gen_any_buffer_unstable_docs!(ANY, $($struct ::)? $baked)]
172172
pub fn $any(provider: &(impl $crate::AnyProvider + ?Sized)) -> Result<Self, $error_ty> {
@@ -190,7 +190,7 @@ macro_rules! gen_any_buffer_data_constructors {
190190
///
191191
/// [📚 Help choosing a constructor](icu_provider::constructors)
192192
pub fn $baked() -> $result_ty {
193-
$($struct :: )? $unstable(&crate::data::Provider)
193+
$($struct :: )? $unstable(&crate::provider::Baked)
194194
}
195195
#[doc = $crate::gen_any_buffer_unstable_docs!(ANY, $($struct ::)? $baked)]
196196
pub fn $any(provider: &(impl $crate::AnyProvider + ?Sized)) -> $result_ty {
@@ -228,7 +228,7 @@ macro_rules! gen_any_buffer_data_constructors {
228228
///
229229
/// [📚 Help choosing a constructor](icu_provider::constructors)
230230
pub fn $baked($options_arg: $options_ty) -> $result_ty {
231-
$($struct :: )? $unstable(&crate::data::Provider, $options_arg)
231+
$($struct :: )? $unstable(&crate::provider::Baked, $options_arg)
232232
}
233233
#[doc = $crate::gen_any_buffer_unstable_docs!(ANY, $($struct ::)? $baked)]
234234
pub fn $any(provider: &(impl $crate::AnyProvider + ?Sized), $options_arg: $options_ty) -> $result_ty {
@@ -250,7 +250,7 @@ macro_rules! gen_any_buffer_data_constructors {
250250
///
251251
/// [📚 Help choosing a constructor](icu_provider::constructors)
252252
pub fn $baked($options_arg: $options_ty) -> Result<Self, $error_ty> {
253-
$($struct :: )? $unstable(&crate::data::Provider, $options_arg)
253+
$($struct :: )? $unstable(&crate::provider::Baked, $options_arg)
254254
}
255255
#[doc = $crate::gen_any_buffer_unstable_docs!(ANY, $($struct ::)? $baked)]
256256
pub fn $any(provider: &(impl $crate::AnyProvider + ?Sized), $options_arg: $options_ty) -> Result<Self, $error_ty> {
@@ -287,7 +287,7 @@ macro_rules! gen_any_buffer_data_constructors {
287287
///
288288
/// [📚 Help choosing a constructor](icu_provider::constructors)
289289
pub fn $baked(locale: &$crate::DataLocale) -> Result<Self, $error_ty> {
290-
$($struct :: )? $unstable(&crate::data::Provider, locale)
290+
$($struct :: )? $unstable(&crate::provider::Baked, locale)
291291
}
292292
#[doc = $crate::gen_any_buffer_unstable_docs!(ANY, $($struct ::)? $baked)]
293293
pub fn $any(provider: &(impl $crate::AnyProvider + ?Sized), locale: &$crate::DataLocale) -> Result<Self, $error_ty> {
@@ -326,7 +326,7 @@ macro_rules! gen_any_buffer_data_constructors {
326326
///
327327
/// [📚 Help choosing a constructor](icu_provider::constructors)
328328
pub fn $baked(locale: &$crate::DataLocale, $config_arg: $config_ty, $options_arg: $options_ty) -> Result<Self, $error_ty> {
329-
$($struct :: )? $unstable(&crate::data::Provider, locale, $config_arg, $options_arg)
329+
$($struct :: )? $unstable(&crate::provider::Baked, locale, $config_arg, $options_arg)
330330
}
331331
#[doc = $crate::gen_any_buffer_unstable_docs!(ANY, $($struct ::)? $baked)]
332332
pub fn $any(provider: &(impl $crate::AnyProvider + ?Sized), locale: &$crate::DataLocale, $config_arg: $config_ty, $options_arg: $options_ty) -> Result<Self, $error_ty> {
@@ -364,7 +364,7 @@ macro_rules! gen_any_buffer_data_constructors {
364364
///
365365
/// [📚 Help choosing a constructor](icu_provider::constructors)
366366
pub fn $baked(locale: &$crate::DataLocale, $options_arg: $options_ty) -> Result<Self, $error_ty> {
367-
$($struct :: )? $unstable(&crate::data::Provider, locale, $options_arg)
367+
$($struct :: )? $unstable(&crate::provider::Baked, locale, $options_arg)
368368
}
369369
#[doc = $crate::gen_any_buffer_unstable_docs!(ANY, $($struct ::)? $baked)]
370370
pub fn $any(provider: &(impl $crate::AnyProvider + ?Sized), locale: &$crate::DataLocale, $options_arg: $options_ty) -> Result<Self, $error_ty> {

0 commit comments

Comments
 (0)