Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s/data/compiled_data #3603

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/calendar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ databake = { version = "0.1.3", path = "../../utils/databake", features = ["deri
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"], optional = true }

icu_calendar_data = { version = "~1.3.0", path = "data", optional = true }
icu_locid_transform = { version = "1.2.0", path = "../../components/locid_transform", features = ["data"], optional = true }
icu_locid_transform = { version = "1.2.0", path = "../../components/locid_transform", features = ["compiled_data"], optional = true }

libm = { version = "0.2", default-features = false }

Expand All @@ -56,7 +56,7 @@ std = ["icu_provider/std", "icu_locid/std"]
serde = ["dep:serde", "zerovec/serde", "tinystr/serde", "icu_provider/serde"]
datagen = ["serde", "dep:databake", "zerovec/databake", "tinystr/databake"]
bench = []
data = ["dep:icu_calendar_data", "dep:icu_locid_transform"]
compiled_data = ["dep:icu_calendar_data", "dep:icu_locid_transform"]

[package.metadata.cargo-all-features]
# Bench feature gets tested separately and is only relevant for CI
Expand Down
8 changes: 4 additions & 4 deletions components/calendar/src/any_calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,10 @@ impl AnyCalendar {
/// 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()`].
///
/// ✨ **Enabled with the `"data"` feature.**
/// ✨ **Enabled with the `"compiled_data"` feature.**
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub const fn new(kind: AnyCalendarKind) -> Self {
match kind {
AnyCalendarKind::Gregorian => AnyCalendar::Gregorian(Gregorian),
Expand Down Expand Up @@ -503,10 +503,10 @@ impl AnyCalendar {
/// 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.
///
/// ✨ **Enabled with the `"data"` feature.**
/// ✨ **Enabled with the `"compiled_data"` feature.**
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn new_for_locale(locale: &DataLocale) -> Self {
let kind = AnyCalendarKind::from_data_locale_with_fallback(locale);
Self::new(kind)
Expand Down
8 changes: 4 additions & 4 deletions components/calendar/src/japanese.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ pub struct JapaneseDateInner {
impl Japanese {
/// Creates a new [`Japanese`] using only modern eras (post-meiji).
///
/// ✨ **Enabled with the `"data"` feature.**
/// ✨ **Enabled with the `"compiled_data"` feature.**
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub const fn new() -> Self {
Self {
eras: DataPayload::from_static_ref(
Expand Down Expand Up @@ -169,10 +169,10 @@ impl Japanese {
impl JapaneseExtended {
/// Creates a new [`Japanese`] from using all eras (including pre-meiji).
///
/// ✨ **Enabled with the `"data"` feature.**
/// ✨ **Enabled with the `"compiled_data"` feature.**
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub const fn new() -> Self {
Self(Japanese {
eras: DataPayload::from_static_ref(
Expand Down
4 changes: 2 additions & 2 deletions components/calendar/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ use icu_provider::prelude::*;
use tinystr::TinyStr16;
use zerovec::ZeroVec;

#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
#[derive(Debug)]
/// Baked data
pub struct Baked;

#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
const _: () = {
use crate as icu_calendar;
icu_calendar_data::impl_calendar_japanese_v1!(Baked);
Expand Down
4 changes: 2 additions & 2 deletions components/collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ databake = { version = "0.1.3", path = "../../utils/databake", optional = true,
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"], optional = true }

icu_collator_data = { version = "~1.3.0", path = "data", optional = true }
icu_locid_transform = { version = "1.2.0", path = "../../components/locid_transform", features = ["data"], optional = true }
icu_locid_transform = { version = "1.2.0", path = "../../components/locid_transform", features = ["compiled_data"], optional = true }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (here and elsewhere): This is a bit misleading; I would prefer if you included icu_locid_transform without compiled_data up here and then included it with the feature down in the compiled_data section:

icu_locid_transform = { version = "1.2.0", path = "../../components/locid_transform", optional = true }

...

compiled_data = ["dep:icu_collator_data", "icu_normalizer/compiled_data", "dep:icu_locid_transform", "icu_locid_transform/compiled_data"]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is preexisting and I'd like to keep this PR a clean rename.


[dev-dependencies]
arraystring = "0.3.0"
Expand All @@ -56,7 +56,7 @@ criterion = "0.4"
std = ["icu_collections/std", "icu_locid/std", "icu_normalizer/std", "icu_properties/std", "icu_provider/std"]
serde = ["dep:serde", "zerovec/serde", "icu_properties/serde", "icu_normalizer/serde", "icu_collections/serde", "icu_provider/serde"]
datagen = ["serde", "dep:databake", "zerovec/databake", "icu_properties/datagen", "icu_normalizer/datagen", "icu_collections/databake"]
data = ["dep:icu_collator_data", "icu_normalizer/data", "dep:icu_locid_transform"]
compiled_data = ["dep:icu_collator_data", "icu_normalizer/compiled_data", "dep:icu_locid_transform"]

[[test]]
name = "tests"
Expand Down
2 changes: 1 addition & 1 deletion components/collator/src/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub struct Collator {

impl Collator {
/// Instantiates a collator for a given locale with the given options
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn try_new(locale: &DataLocale, options: CollatorOptions) -> Result<Self, CollatorError> {
Self::try_new_unstable_internal(
&crate::provider::Baked,
Expand Down
4 changes: 2 additions & 2 deletions components/collator/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ use crate::elements::NO_CE_PRIMARY;
use super::CaseFirst;
use super::MaxVariable;

#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
#[derive(Debug)]
/// Baked data
pub struct Baked;

#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
const _: () = {
use crate as icu_collator;
icu_collator_data::impl_collator_data_v1!(Baked);
Expand Down
2 changes: 1 addition & 1 deletion components/collections/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ criterion = "0.4"
icu_benchmark_macros = { path = "../../tools/benchmark/macros" }
iai = "0.1.1"
icu = { path = "../icu", default-features = false }
icu_properties = { path = "../properties", features = ["data"] }
icu_properties = { path = "../properties", features = ["compiled_data"] }

[features]
std = []
Expand Down
4 changes: 2 additions & 2 deletions components/datetime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ serde = { version = "1.0", default-features = false, features = ["derive", "allo
databake = { version = "0.1.3", path = "../../utils/databake", features = ["derive"], optional = true}

icu_datetime_data = { version = "~1.3.0", path = "data", optional = true }
icu_locid_transform = { version = "1.2.0", path = "../../components/locid_transform", features = ["data"], optional = true }
icu_locid_transform = { version = "1.2.0", path = "../../components/locid_transform", features = ["compiled_data"], optional = true }

# Experimental
litemap = { version = "0.7.0", path = "../../utils/litemap", optional = true }
Expand Down Expand Up @@ -98,7 +98,7 @@ datagen = [
]
experimental = ["dep:litemap"]
bench = ["serde"]
data = ["dep:icu_datetime_data", "dep:icu_locid_transform", "icu_calendar/data", "icu_decimal/data", "icu_plurals/data", "icu_timezone/data"]
compiled_data = ["dep:icu_datetime_data", "dep:icu_locid_transform", "icu_calendar/compiled_data", "icu_decimal/compiled_data", "icu_plurals/compiled_data", "icu_timezone/compiled_data"]

[lib]
path = "src/lib.rs"
Expand Down
4 changes: 2 additions & 2 deletions components/datetime/src/any/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ impl DateFormatter {
/// );
/// ```
///
/// ✨ **Enabled with the `"data"` feature.**
/// ✨ **Enabled with the `"compiled_data"` feature.**
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[inline(never)]
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn try_new_with_length(
locale: &DataLocale,
length: length::Date,
Expand Down
6 changes: 3 additions & 3 deletions components/datetime/src/any/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ impl DateTimeFormatter {
/// "Sep 1, 2020, 12:34 PM"
/// );
/// ```
/// ✨ **Enabled with the `"data"` feature.**
/// ✨ **Enabled with the `"compiled_data"` feature.**
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
#[inline]
pub fn try_new(
locale: &DataLocale,
Expand Down Expand Up @@ -332,7 +332,7 @@ impl DateTimeFormatter {
/// );
/// ```
#[cfg(feature = "experimental")]
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
#[inline(never)]
pub fn try_new_experimental(
locale: &DataLocale,
Expand Down
8 changes: 4 additions & 4 deletions components/datetime/src/any/zoned_datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ impl ZonedDateTimeFormatter {
/// );
/// ```
///
/// ✨ **Enabled with the `"data"` feature.**
/// ✨ **Enabled with the `"compiled_data"` feature.**
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "experimental")]
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn try_new_experimental(
locale: &DataLocale,
date_time_format_options: DateTimeFormatterOptions,
Expand Down Expand Up @@ -308,10 +308,10 @@ impl ZonedDateTimeFormatter {
/// );
/// ```
///
/// ✨ **Enabled with the `"data"` feature.**
/// ✨ **Enabled with the `"compiled_data"` feature.**
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn try_new(
locale: &DataLocale,
date_time_format_options: DateTimeFormatterOptions,
Expand Down
16 changes: 8 additions & 8 deletions components/datetime/src/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ impl TimeFormatter {
/// .unwrap();
/// ```
///
/// ✨ **Enabled with the `"data"` feature.**
/// ✨ **Enabled with the `"compiled_data"` feature.**
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn try_new_with_length(
locale: &DataLocale,
length: length::Time,
Expand Down Expand Up @@ -285,10 +285,10 @@ impl<C: CldrCalendar> TypedDateFormatter<C> {
///
/// [`DateFormatter`]: crate::DateFormatter
///
/// ✨ **Enabled with the `"data"` feature.**
/// ✨ **Enabled with the `"compiled_data"` feature.**
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn try_new_with_length(
locale: &DataLocale,
length: length::Date,
Expand Down Expand Up @@ -522,10 +522,10 @@ where {
///
/// [data provider]: icu_provider
///
/// ✨ **Enabled with the `"data"` feature.**
/// ✨ **Enabled with the `"compiled_data"` feature.**
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn try_new(
locale: &DataLocale,
options: DateTimeFormatterOptions,
Expand Down Expand Up @@ -640,12 +640,12 @@ where {
///
/// [data provider]: icu_provider
///
/// ✨ **Enabled with the `"data"` feature.**
/// ✨ **Enabled with the `"compiled_data"` feature.**
///
/// [📚 Help choosing a constructor](icu_provider::constructors)
#[cfg(feature = "experimental")]
#[inline]
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn try_new_experimental(
locale: &DataLocale,
options: DateTimeFormatterOptions,
Expand Down
4 changes: 2 additions & 2 deletions components/datetime/src/provider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ pub mod calendar;
pub(crate) mod date_time;
pub mod time_zones;

#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
#[derive(Debug)]
/// Baked data
pub struct Baked;

#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
const _: () = {
use crate as icu_datetime;
icu_datetime_data::impl_datetime_buddhist_datelengths_v1!(Baked);
Expand Down
6 changes: 3 additions & 3 deletions components/datetime/src/raw/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub(crate) struct TimeFormatter {

impl TimeFormatter {
#[inline(never)]
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn try_new(
locale: &DataLocale,
length: length::Time,
Expand Down Expand Up @@ -165,7 +165,7 @@ pub(crate) struct DateFormatter {
}

impl DateFormatter {
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
#[inline(never)]
pub fn try_new(
patterns_data: DataPayload<ErasedDateLengthsV1Marker>,
Expand Down Expand Up @@ -374,7 +374,7 @@ impl DateTimeFormatter {
}

#[inline(never)]
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn try_new(
patterns: DataPayload<PatternPluralsFromPatternsV1Marker>,
symbols_data_fn: impl FnOnce() -> Result<DataPayload<ErasedDateSymbolsV1Marker>, DataError>,
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/raw/zoned_datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub(crate) struct ZonedDateTimeFormatter {

impl ZonedDateTimeFormatter {
#[inline(never)]
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn try_new(
patterns: DataPayload<PatternPluralsFromPatternsV1Marker>,
symbols_data_fn: impl FnOnce() -> Result<DataPayload<ErasedDateSymbolsV1Marker>, DataError>,
Expand Down
10 changes: 5 additions & 5 deletions components/datetime/src/time_zone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,39 +464,39 @@ impl TimeZoneFormatter {
}

/// Load generic non location long format for timezone from compiled data. For example, Pacific Time.
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn with_generic_non_location_long(
&mut self,
) -> Result<&mut TimeZoneFormatter, DateTimeError> {
self.load_generic_non_location_long(&crate::provider::Baked)
}

/// Load generic non location short format for timezone from compiled data. For example, PT.
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn with_generic_non_location_short(
&mut self,
) -> Result<&mut TimeZoneFormatter, DateTimeError> {
self.load_generic_non_location_short(&crate::provider::Baked)
}

/// Load specific non location long format for timezone from compiled data. For example, Pacific Standard Time.
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn with_specific_non_location_long(
&mut self,
) -> Result<&mut TimeZoneFormatter, DateTimeError> {
self.load_specific_non_location_long(&crate::provider::Baked)
}

/// Load specific non location short format for timezone from compiled data. For example, PDT.
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn with_specific_non_location_short(
&mut self,
) -> Result<&mut TimeZoneFormatter, DateTimeError> {
self.load_specific_non_location_short(&crate::provider::Baked)
}

/// Load generic location format for timezone. For example, Los Angeles Time.
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn with_generic_location_format(
&mut self,
) -> Result<&mut TimeZoneFormatter, DateTimeError> {
Expand Down
4 changes: 2 additions & 2 deletions components/datetime/src/zoned_datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl<C: CldrCalendar> TypedZonedDateTimeFormatter<C> {
///
/// [data provider]: icu_provider
#[cfg(feature = "experimental")]
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
#[inline]
pub fn try_new_experimental(
locale: &DataLocale,
Expand Down Expand Up @@ -237,7 +237,7 @@ impl<C: CldrCalendar> TypedZonedDateTimeFormatter<C> {
///
/// [data provider]: icu_provider
#[inline]
#[cfg(feature = "data")]
#[cfg(feature = "compiled_data")]
pub fn try_new(
locale: &DataLocale,
date_time_format_options: DateTimeFormatterOptions,
Expand Down
Loading