From 64103096de93f15f9ca69bc8dacd924d001ad3e9 Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Mon, 18 Nov 2024 17:45:17 -0800 Subject: [PATCH] Rename modules to fieldsets::enums (#5836) --- README.md | 2 +- components/datetime/README.md | 8 +- components/datetime/benches/datetime.rs | 2 +- components/datetime/benches/fixtures/mod.rs | 2 +- components/datetime/examples/work_log.rs | 2 +- components/datetime/src/combo.rs | 10 +- components/datetime/src/dynamic.rs | 86 +-- .../src/{fieldset.rs => fieldsets.rs} | 80 +-- components/datetime/src/lib.rs | 10 +- components/datetime/src/neo.rs | 34 +- components/datetime/src/neo_serde.rs | 73 ++- components/datetime/src/options/mod.rs | 10 +- components/datetime/src/pattern/formatter.rs | 2 +- components/datetime/src/pattern/names.rs | 26 +- components/datetime/src/pattern/pattern.rs | 2 +- components/datetime/src/raw/neo.rs | 22 +- .../datetime/src/scaffold/dynamic_impls.rs | 2 +- components/datetime/tests/datetime.rs | 6 +- components/datetime/tests/fixtures/mod.rs | 2 +- .../datetime/tests/patterns/time_zones.rs | 16 +- .../datetime/tests/resolved_components.rs | 15 +- components/datetime/tests/simple_test.rs | 42 +- components/icu/README.md | 4 +- components/icu/examples/tui.rs | 2 +- components/icu/src/lib.rs | 4 +- ffi/capi/src/datetime_formatter.rs | 2 +- ffi/capi/src/zoned_formatter.rs | 2 +- ffi/capi/tests/missing_apis.txt | 506 +++++++++--------- provider/source/src/datetime/neo_skeleton.rs | 2 +- tools/make/diplomat-coverage/src/allowlist.rs | 2 +- tutorials/data_management.md | 4 +- tutorials/intro.md | 2 +- tutorials/intro_interactive.md | 2 +- tutorials/rust/buffer/src/main.rs | 2 +- 34 files changed, 472 insertions(+), 516 deletions(-) rename components/datetime/src/{fieldset.rs => fieldsets.rs} (96%) diff --git a/README.md b/README.md index 7862ee18fd3..64067fe685e 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ icu = "1.5.0" ```rust use icu::calendar::DateTime; -use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldset::YMDT}; +use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldsets::YMDT}; use icu::locale::locale; let dtf = DateTimeFormatter::try_new( diff --git a/components/datetime/README.md b/components/datetime/README.md index e227fbe6b61..5d13c0b8288 100644 --- a/components/datetime/README.md +++ b/components/datetime/README.md @@ -10,7 +10,7 @@ and as part of the [`icu`](https://docs.rs/icu/latest/icu/) crate. See the latte ICU4X datetime formatting follows the Unicode UTS 35 standard for [Semantic Skeletons](https://unicode.org/reports/tr35/tr35-dates.html#Semantic_Skeletons). First you choose a _field set_, then you configure the formatting _options_ to your desired context. -1. Field Sets: [`icu::datetime::fieldset`](fieldset) +1. Field Sets: [`icu::datetime::fieldsets`](fieldsets) 2. Options: [`icu::datetime::options`](options) ICU4X supports formatting in over one dozen _calendar systems_, including Gregorian, Buddhist, @@ -41,7 +41,7 @@ and calendar systems: | Factor | Static (Lower Binary Size) | Dynamic (Greater Binary Size) | |---|---|---| -| Field Sets | Specific [`fieldset`] types | Enumerations from [`fieldset::dynamic`] | +| Field Sets | Specific [`fieldsets`] types | Enumerations from [`fieldsets::enums`] | | Calendar Systems | [`FixedCalendarDateTimeFormatter`] | [`DateTimeFormatter`] | If formatting times and time zones without dates, consider using [`TimeFormatter`]. @@ -50,13 +50,13 @@ If formatting times and time zones without dates, consider using [`TimeFormatter ```rust use icu::calendar::DateTime; -use icu::datetime::fieldset; +use icu::datetime::fieldsets; use icu::datetime::DateTimeFormatter; use icu::locale::{locale, Locale}; use writeable::assert_try_writeable_eq; // Field set for year, month, day, hour, and minute with a medium length: -let field_set = fieldset::YMDT::medium().hm(); +let field_set = fieldsets::YMDT::medium().hm(); // Create a formatter for Argentinian Spanish: let locale = locale!("es-AR"); diff --git a/components/datetime/benches/datetime.rs b/components/datetime/benches/datetime.rs index 799356d60b5..8741f35f620 100644 --- a/components/datetime/benches/datetime.rs +++ b/components/datetime/benches/datetime.rs @@ -5,7 +5,7 @@ mod fixtures; use criterion::{criterion_group, criterion_main, Criterion}; -use icu_datetime::{fieldset::dynamic::CompositeFieldSet, FixedCalendarDateTimeFormatter}; +use icu_datetime::{fieldsets::enums::CompositeFieldSet, FixedCalendarDateTimeFormatter}; use icu_calendar::{Date, DateTime, Gregorian, Time}; use icu_locale_core::Locale; diff --git a/components/datetime/benches/fixtures/mod.rs b/components/datetime/benches/fixtures/mod.rs index 77dc4265fb1..924967eafb7 100644 --- a/components/datetime/benches/fixtures/mod.rs +++ b/components/datetime/benches/fixtures/mod.rs @@ -2,7 +2,7 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -use icu_datetime::{fields::components, fieldset::serde::CompositeFieldSetSerde, options}; +use icu_datetime::{fields::components, fieldsets::serde::CompositeFieldSetSerde, options}; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] diff --git a/components/datetime/examples/work_log.rs b/components/datetime/examples/work_log.rs index 8c4c91af5d2..9a8f7ff6672 100644 --- a/components/datetime/examples/work_log.rs +++ b/components/datetime/examples/work_log.rs @@ -10,7 +10,7 @@ icu_benchmark_macros::instrument!(); use icu_benchmark_macros::println; use icu_calendar::DateTime; -use icu_datetime::{fieldset::YMDT, FixedCalendarDateTimeFormatter}; +use icu_datetime::{fieldsets::YMDT, FixedCalendarDateTimeFormatter}; use icu_locale_core::locale; const DATES_ISO: &[(i32, u8, u8, u8, u8, u8)] = &[ diff --git a/components/datetime/src/combo.rs b/components/datetime/src/combo.rs index 5c456655cc8..98dff18245c 100644 --- a/components/datetime/src/combo.rs +++ b/components/datetime/src/combo.rs @@ -15,7 +15,7 @@ use crate::{provider::neo::*, scaffold::*}; /// Two ways to construct the same combo field set (in this case, weekday with location-based zone): /// /// ``` -/// use icu::datetime::fieldset::{Combo, E, L}; +/// use icu::datetime::fieldsets::{Combo, E, L}; /// /// let field_set_1 = E::long().zone_l(); /// let field_set_2 = Combo::::long(); @@ -26,7 +26,7 @@ use crate::{provider::neo::*, scaffold::*}; /// Format the weekday, hour, and location-based zone: /// /// ``` -/// use icu::datetime::fieldset::{Combo, ET, L}; +/// use icu::datetime::fieldsets::{Combo, ET, L}; /// use icu::datetime::DateTimeFormatter; /// use icu::locale::locale; /// use icu::timezone::IxdtfParser; @@ -54,7 +54,7 @@ use crate::{provider::neo::*, scaffold::*}; /// /// ``` /// use icu::calendar::Gregorian; -/// use icu::datetime::fieldset::{Combo, ET, L}; +/// use icu::datetime::fieldsets::{Combo, ET, L}; /// use icu::datetime::FixedCalendarDateTimeFormatter; /// use icu::locale::locale; /// use icu::timezone::IxdtfParser; @@ -79,11 +79,11 @@ use crate::{provider::neo::*, scaffold::*}; /// ); /// ``` /// -/// Mix a dynamic [`DateFieldSet`](crate::fieldset::dynamic::DateFieldSet) +/// Mix a dynamic [`DateFieldSet`](crate::fieldsets::enums::DateFieldSet) /// with a static time zone: /// /// ``` -/// use icu::datetime::fieldset::{Combo, YMD, Vs, dynamic::DateFieldSet}; +/// use icu::datetime::fieldsets::{Combo, YMD, Vs, enums::DateFieldSet}; /// use icu::datetime::DateTimeFormatter; /// use icu::locale::locale; /// use icu::timezone::IxdtfParser; diff --git a/components/datetime/src/dynamic.rs b/components/datetime/src/dynamic.rs index c0cf3c25893..64e9637b9a4 100644 --- a/components/datetime/src/dynamic.rs +++ b/components/datetime/src/dynamic.rs @@ -29,19 +29,19 @@ //! //! ``` //! use icu::calendar::DateTime; -//! use icu::datetime::fieldset; -//! use icu::datetime::fieldset::dynamic::CompositeDateTimeFieldSet; +//! use icu::datetime::fieldsets; +//! use icu::datetime::fieldsets::enums::CompositeDateTimeFieldSet; //! use icu::datetime::DateTimeFormatter; //! use icu::locale::locale; //! use writeable::TryWriteable; //! //! fn get_field_set(should_display_time: bool) -> CompositeDateTimeFieldSet { //! if should_display_time { -//! let field_set = fieldset::MDT::medium().hm(); -//! CompositeDateTimeFieldSet::DateTime(fieldset::dynamic::DateAndTimeFieldSet::MDT(field_set)) +//! let field_set = fieldsets::MDT::medium().hm(); +//! CompositeDateTimeFieldSet::DateTime(fieldsets::enums::DateAndTimeFieldSet::MDT(field_set)) //! } else { -//! let field_set = fieldset::MD::medium(); -//! CompositeDateTimeFieldSet::Date(fieldset::dynamic::DateFieldSet::MD(field_set)) +//! let field_set = fieldsets::MD::medium(); +//! CompositeDateTimeFieldSet::Date(fieldsets::enums::DateFieldSet::MD(field_set)) //! } //! } //! @@ -57,9 +57,9 @@ //! assert_eq!(results, ["Jan 15, 4:00 PM", "Jan 15"]) //! ``` -use crate::raw::neo::RawNeoOptions; +use crate::raw::neo::RawOptions; use crate::scaffold::GetField; -use crate::{fields, fieldset, NeoSkeletonLength}; +use crate::{fields, fieldsets, NeoSkeletonLength}; use icu_provider::prelude::*; /// An enumeration over all possible date field sets. @@ -68,25 +68,25 @@ use icu_provider::prelude::*; pub enum DateFieldSet { /// The day of the month, as in /// “on the 1st”. - D(fieldset::D), + D(fieldsets::D), /// The month and day of the month, as in /// “January 1st”. - MD(fieldset::MD), + MD(fieldsets::MD), /// The year, month, and day of the month, as in /// “January 1st, 2000”. - YMD(fieldset::YMD), + YMD(fieldsets::YMD), /// The day of the month and day of the week, as in /// “Saturday 1st”. - DE(fieldset::DE), + DE(fieldsets::DE), /// The month, day of the month, and day of the week, as in /// “Saturday, January 1st”. - MDE(fieldset::MDE), + MDE(fieldsets::MDE), /// The year, month, day of the month, and day of the week, as in /// “Saturday, January 1st, 2000”. - YMDE(fieldset::YMDE), + YMDE(fieldsets::YMDE), /// The day of the week alone, as in /// “Saturday”. - E(fieldset::E), + E(fieldsets::E), } /// An enumeration over all possible calendar period field sets. @@ -95,17 +95,17 @@ pub enum DateFieldSet { pub enum CalendarPeriodFieldSet { /// A standalone month, as in /// “January”. - M(fieldset::M), + M(fieldsets::M), /// A month and year, as in /// “January 2000”. - YM(fieldset::YM), + YM(fieldsets::YM), /// A year, as in /// “2000”. - Y(fieldset::Y), + Y(fieldsets::Y), // TODO: Add support for week-of-year // /// The year and week of the year, as in // /// “52nd week of 1999”. - // YW(fieldset::YW), + // YW(fieldsets::YW), // TODO(#501): Consider adding support for Quarter and YearQuarter. } @@ -114,12 +114,12 @@ pub enum CalendarPeriodFieldSet { #[non_exhaustive] pub enum TimeFieldSet { /// A time of day. - T(fieldset::T), + T(fieldsets::T), } /// An enumeration over all possible zone field sets. /// -/// Note: [`fieldset::Zs`] and [`fieldset::Vs`] are not included in this enum +/// Note: [`fieldsets::Zs`] and [`fieldsets::Vs`] are not included in this enum /// because they are data size optimizations only. /// /// # Time Zone Data Size @@ -127,23 +127,23 @@ pub enum TimeFieldSet { /// Time zone names contribute a lot of data size. For resource-constrained /// environments, the following formats require the least amount of data: /// -/// - [`fieldset::Zs`] -/// - [`fieldset::O`] +/// - [`fieldsets::Zs`] +/// - [`fieldsets::O`] #[derive(Debug, Copy, Clone, PartialEq, Eq)] #[non_exhaustive] pub enum ZoneFieldSet { /// The specific non-location format, as in /// “Pacific Daylight Time”. - Z(fieldset::Z), + Z(fieldsets::Z), /// The offset format, as in /// “GMT−8”. - O(fieldset::O), + O(fieldsets::O), /// The generic non-location format, as in /// “Pacific Time”. - V(fieldset::V), + V(fieldsets::V), /// The location format, as in /// “Los Angeles time”. - L(fieldset::L), + L(fieldsets::L), } /// An enumeration over all possible zone styles. @@ -173,25 +173,25 @@ pub enum ZoneStyle { pub enum DateAndTimeFieldSet { /// The day of the month with time of day, as in /// “on the 1st at 10:31 AM”. - DT(fieldset::DT), + DT(fieldsets::DT), /// The month and day of the month with time of day, as in /// “January 1st at 10:31 AM”. - MDT(fieldset::MDT), + MDT(fieldsets::MDT), /// The year, month, and day of the month with time of day, as in /// “January 1st, 2000 at 10:31 AM”. - YMDT(fieldset::YMDT), + YMDT(fieldsets::YMDT), /// The day of the month and day of the week with time of day, as in /// “Saturday 1st at 10:31 AM”. - DET(fieldset::DET), + DET(fieldsets::DET), /// The month, day of the month, and day of the week with time of day, as in /// “Saturday, January 1st at 10:31 AM”. - MDET(fieldset::MDET), + MDET(fieldsets::MDET), /// The year, month, day of the month, and day of the week with time of day, as in /// “Saturday, January 1st, 2000 at 10:31 AM”. - YMDET(fieldset::YMDET), + YMDET(fieldsets::YMDET), /// The day of the week alone with time of day, as in /// “Saturday at 10:31 AM”. - ET(fieldset::ET), + ET(fieldsets::ET), } /// An enum supporting date, calendar period, time, and date+time field sets @@ -296,7 +296,7 @@ macro_rules! impl_attrs { /// # Examples /// /// ``` - #[doc = concat!("use icu::datetime::fieldset::dynamic::", stringify!($type), " as FS;")] + #[doc = concat!("use icu::datetime::fieldsets::enums::", stringify!($type), " as FS;")] /// use icu_provider::DataMarkerAttributes; /// /// assert!(FS::ALL_DATA_MARKER_ATTRIBUTES.contains( @@ -324,7 +324,7 @@ macro_rules! impl_attrs { }; (@to_raw_options, $type:path, [$($variant:ident),+,]) => { impl $type { - pub(crate) fn to_raw_options(self) -> RawNeoOptions { + pub(crate) fn to_raw_options(self) -> RawOptions { match self { $( Self::$variant(variant) => variant.to_raw_options(), @@ -393,17 +393,17 @@ macro_rules! impl_attrs { Self::$variant(variant) => (variant.length, variant.time_precision, variant.alignment), )+ }; - TimeFieldSet::T(fieldset::T { + TimeFieldSet::T(fieldsets::T { length, time_precision, alignment, }) } #[cfg(all(feature = "serde", feature = "experimental"))] - pub(crate) fn from_date_field_set_with_raw_options(date_field_set: DateFieldSet, options: RawNeoOptions) -> Self { + pub(crate) fn from_date_field_set_with_raw_options(date_field_set: DateFieldSet, options: RawOptions) -> Self { match date_field_set { $( - DateFieldSet::$d_variant(_) => Self::$variant(fieldset::$variant::from_raw_options(options)), + DateFieldSet::$d_variant(_) => Self::$variant(fieldsets::$variant::from_raw_options(options)), )+ } } @@ -476,10 +476,10 @@ impl ZoneFieldSet { length: NeoSkeletonLength, ) -> Self { match style { - ZoneStyle::Z => Self::Z(fieldset::Z::with_length(length)), - ZoneStyle::O => Self::O(fieldset::O::with_length(length)), - ZoneStyle::V => Self::V(fieldset::V::with_length(length)), - ZoneStyle::L => Self::L(fieldset::L::with_length(length)), + ZoneStyle::Z => Self::Z(fieldsets::Z::with_length(length)), + ZoneStyle::O => Self::O(fieldsets::O::with_length(length)), + ZoneStyle::V => Self::V(fieldsets::V::with_length(length)), + ZoneStyle::L => Self::L(fieldsets::L::with_length(length)), } } } diff --git a/components/datetime/src/fieldset.rs b/components/datetime/src/fieldsets.rs similarity index 96% rename from components/datetime/src/fieldset.rs rename to components/datetime/src/fieldsets.rs index 25cd88f328c..2c45e4dd310 100644 --- a/components/datetime/src/fieldset.rs +++ b/components/datetime/src/fieldsets.rs @@ -12,7 +12,7 @@ //! Two ways to configure the same field set: //! //! ``` -//! use icu::datetime::fieldset::YMDT; +//! use icu::datetime::fieldsets::YMDT; //! use icu::datetime::options::{Alignment, TimePrecision, YearStyle}; //! //! let field_set_1 = YMDT::long() @@ -29,7 +29,7 @@ //! ``` #[path = "dynamic.rs"] -pub mod dynamic; +pub mod enums; pub use crate::combo::Combo; @@ -37,10 +37,10 @@ use crate::{ fields, options::*, provider::{neo::*, time_zones::tz, *}, - raw::neo::RawNeoOptions, + raw::neo::RawOptions, scaffold::*, }; -use dynamic::*; +use enums::*; use icu_calendar::{ types::{ DayOfMonth, IsoHour, IsoMinute, IsoSecond, IsoWeekday, MonthInfo, NanoSecond, YearInfo, @@ -195,8 +195,8 @@ macro_rules! impl_marker_with_options { const _: () = yes_to!((), $enumerated_yes); // condition for this macro block #[warn(dead_code)] )? - pub(crate) fn to_raw_options(self) -> RawNeoOptions { - RawNeoOptions { + pub(crate) fn to_raw_options(self) -> RawOptions { + RawOptions { length: self.length, alignment: ternary!(self.alignment, None, $($alignment_yes)?), year_style: ternary!(self.year_style, None, $($yearstyle_yes)?), @@ -207,7 +207,7 @@ macro_rules! impl_marker_with_options { const _: () = yes_to!((), $enumerated_yes); // condition for this macro block #[warn(dead_code)] )? - pub(crate) fn from_raw_options(options: RawNeoOptions) -> Self { + pub(crate) fn from_raw_options(options: RawOptions) -> Self { Self { length: options.length, $(alignment: yes_to!(options.alignment, $alignment_yes),)? @@ -246,11 +246,6 @@ macro_rules! impl_marker_with_options { self.time_precision = Some(TimePrecision::MinuteExact); self } - /// Sets the time precision to [`TimePrecision::SecondPlus`] - pub fn hms(mut self) -> Self { - self.time_precision = Some(TimePrecision::SecondPlus); - self - } } )? }; @@ -374,7 +369,7 @@ macro_rules! impl_date_or_calendar_period_marker { /// ``` /// use icu::calendar::Date; /// use icu::datetime::DateTimeFormatter; - #[doc = concat!("use icu::datetime::fieldset::", stringify!($type), ";")] + #[doc = concat!("use icu::datetime::fieldsets::", stringify!($type), ";")] /// use icu::locale::locale; /// use writeable::assert_try_writeable_eq; #[doc = concat!("let fmt = DateTimeFormatter::<", stringify!($type), ">::try_new(")] @@ -396,7 +391,7 @@ macro_rules! impl_date_or_calendar_period_marker { /// use icu::calendar::Date; /// use icu::calendar::Gregorian; /// use icu::datetime::FixedCalendarDateTimeFormatter; - #[doc = concat!("use icu::datetime::fieldset::", stringify!($type), ";")] + #[doc = concat!("use icu::datetime::fieldsets::", stringify!($type), ";")] /// use icu::locale::locale; /// use writeable::assert_try_writeable_eq; /// @@ -472,7 +467,6 @@ macro_rules! impl_date_marker { $(#[$attr:meta])* $type:ident, $type_time:ident, - $components:expr, description = $description:literal, sample_length = $sample_length:ident, sample = $sample:literal, @@ -520,7 +514,7 @@ macro_rules! impl_date_marker { /// ``` /// use icu::calendar::DateTime; /// use icu::datetime::DateTimeFormatter; - #[doc = concat!("use icu::datetime::fieldset::", stringify!($type_time), ";")] + #[doc = concat!("use icu::datetime::fieldsets::", stringify!($type_time), ";")] /// use icu::locale::locale; /// use writeable::assert_try_writeable_eq; /// @@ -543,7 +537,7 @@ macro_rules! impl_date_marker { /// use icu::calendar::DateTime; /// use icu::calendar::Gregorian; /// use icu::datetime::FixedCalendarDateTimeFormatter; - #[doc = concat!("use icu::datetime::fieldset::", stringify!($type_time), ";")] + #[doc = concat!("use icu::datetime::fieldsets::", stringify!($type_time), ";")] /// use icu::locale::locale; /// use writeable::assert_try_writeable_eq; /// @@ -640,7 +634,6 @@ macro_rules! impl_calendar_period_marker { ( $(#[$attr:meta])* $type:ident, - $components:expr, description = $description:literal, sample_length = $sample_length:ident, sample = $sample:literal, @@ -682,8 +675,6 @@ macro_rules! impl_time_marker { $(#[$attr:meta])* // The name of the type being created. $type:ident, - // An expression for the field set. - $components:expr, // A plain language description of the field set for documentation. description = $description:literal, // Length of the sample string below. @@ -709,7 +700,7 @@ macro_rules! impl_time_marker { /// ``` /// use icu::calendar::Time; /// use icu::datetime::TimeFormatter; - #[doc = concat!("use icu::datetime::fieldset::", stringify!($type), ";")] + #[doc = concat!("use icu::datetime::fieldsets::", stringify!($type), ";")] /// use icu::locale::locale; /// use writeable::assert_try_writeable_eq; /// @@ -777,8 +768,6 @@ macro_rules! impl_zone_marker { $(#[$attr:meta])* // The name of the type being created. $type:ident, - // An expression for the field set. - $components:expr, // A plain language description of the field set for documentation. description = $description:literal, // Length of the sample string below. @@ -827,7 +816,7 @@ macro_rules! impl_zone_marker { /// use icu::calendar::{Date, Time}; /// use icu::timezone::{TimeZoneBcp47Id, TimeZoneInfo, UtcOffset, ZoneVariant}; /// use icu::datetime::TimeFormatter; - #[doc = concat!("use icu::datetime::fieldset::", stringify!($type), ";")] + #[doc = concat!("use icu::datetime::fieldsets::", stringify!($type), ";")] /// use icu::locale::locale; /// use tinystr::tinystr; /// use writeable::assert_try_writeable_eq; @@ -920,7 +909,7 @@ macro_rules! impl_zoneddatetime_marker { /// use icu::calendar::{Date, Time}; /// use icu::timezone::{TimeZoneInfo, IxdtfParser}; /// use icu::datetime::DateTimeFormatter; - #[doc = concat!("use icu::datetime::fieldset::", stringify!($type), ";")] + #[doc = concat!("use icu::datetime::fieldsets::", stringify!($type), ";")] /// use icu::locale::locale; /// use writeable::assert_try_writeable_eq; /// @@ -945,7 +934,7 @@ macro_rules! impl_zoneddatetime_marker { /// use icu::timezone::{TimeZoneInfo, IxdtfParser}; /// use icu::calendar::Gregorian; /// use icu::datetime::FixedCalendarDateTimeFormatter; - #[doc = concat!("use icu::datetime::fieldset::", stringify!($type), ";")] + #[doc = concat!("use icu::datetime::fieldsets::", stringify!($type), ";")] /// use icu::locale::locale; /// use writeable::assert_try_writeable_eq; /// @@ -973,7 +962,6 @@ impl_date_marker!( /// in the future. See CLDR-18040. D, DT, - NeoDateComponents::Day, description = "day of month (standalone)", sample_length = short, sample = "17", @@ -986,7 +974,6 @@ impl_date_marker!( impl_date_marker!( E, ET, - NeoDateComponents::Weekday, description = "weekday (standalone)", sample_length = long, sample = "Friday", @@ -1000,7 +987,6 @@ impl_date_marker!( /// in the future. See CLDR-18040. DE, DET, - NeoDateComponents::DayWeekday, description = "day of month and weekday", sample_length = long, sample = "17 Friday", @@ -1014,7 +1000,6 @@ impl_date_marker!( impl_date_marker!( MD, MDT, - NeoDateComponents::MonthDay, description = "month and day", sample_length = medium, sample = "May 17", @@ -1030,7 +1015,6 @@ impl_date_marker!( /// See CLDR-18040 for progress on improving this format. MDE, MDET, - NeoDateComponents::MonthDayWeekday, description = "month, day, and weekday", sample_length = medium, sample = "Fri, May 17", @@ -1047,7 +1031,6 @@ impl_date_marker!( impl_date_marker!( YMD, YMDT, - NeoDateComponents::YearMonthDay, description = "year, month, and day", sample_length = short, sample = "5/17/24", @@ -1064,7 +1047,6 @@ impl_date_marker!( impl_date_marker!( YMDE, YMDET, - NeoDateComponents::YearMonthDayWeekday, description = "year, month, day, and weekday", sample_length = short, sample = "Fri, 5/17/24", @@ -1082,7 +1064,6 @@ impl_date_marker!( impl_calendar_period_marker!( Y, - NeoCalendarPeriodComponents::Year, description = "year (standalone)", sample_length = medium, sample = "2024", @@ -1094,7 +1075,6 @@ impl_calendar_period_marker!( impl_calendar_period_marker!( M, - NeoCalendarPeriodComponents::Month, description = "month (standalone)", sample_length = long, sample = "May", @@ -1106,7 +1086,6 @@ impl_calendar_period_marker!( impl_calendar_period_marker!( YM, - NeoCalendarPeriodComponents::YearMonth, description = "year and month", sample_length = medium, sample = "May 2024", @@ -1123,7 +1102,7 @@ impl_time_marker!( /// /// ``` /// use icu::calendar::Time; - /// use icu::datetime::fieldset::T; + /// use icu::datetime::fieldsets::T; /// use icu::datetime::TimeFormatter; /// use icu::locale::locale; /// use writeable::assert_try_writeable_eq; @@ -1176,7 +1155,7 @@ impl_time_marker!( /// /// ``` /// use icu::calendar::Time; - /// use icu::datetime::fieldset::T; + /// use icu::datetime::fieldsets::T; /// use icu::datetime::TimeFormatter; /// use icu::locale::locale; /// use writeable::assert_try_writeable_eq; @@ -1204,7 +1183,6 @@ impl_time_marker!( /// ); /// ``` T, - NeoTimeComponents::Time, description = "time (locale-dependent hour cycle)", sample_length = medium, sample = "3:47:50 PM", @@ -1224,7 +1202,7 @@ impl_zone_marker!( /// use icu::timezone::{IxdtfParser, TimeZoneBcp47Id, TimeZoneInfo, UtcOffset, ZoneVariant}; /// use icu::calendar::Gregorian; /// use icu::datetime::FixedCalendarDateTimeFormatter; - /// use icu::datetime::fieldset::Z; + /// use icu::datetime::fieldsets::Z; /// use icu::locale::locale; /// use tinystr::tinystr; /// use writeable::assert_try_writeable_eq; @@ -1265,7 +1243,7 @@ impl_zone_marker!( /// ```compile_fail,E0271 /// use icu::calendar::{DateTime, Iso}; /// use icu::datetime::FixedCalendarDateTimeFormatter; - /// use icu::datetime::fieldset::Z; + /// use icu::datetime::fieldsets::Z; /// use icu::timezone::{TimeZoneBcp47Id, UtcOffset, ZoneVariant}; /// use tinystr::tinystr; /// use icu::locale::locale; @@ -1285,7 +1263,6 @@ impl_zone_marker!( /// formatter.format(&time_zone_at_time); /// ``` Z, - NeoTimeZoneStyle::Specific, description = "time zone in specific non-location format", sample_length = long, sample = "Central Daylight Time", @@ -1311,7 +1288,7 @@ impl_zone_marker!( /// ```compile_fail,E0271 /// use icu::calendar::{DateTime, Iso}; /// use icu::datetime::FixedCalendarDateTimeFormatter; - /// use icu::datetime::fieldset::{Combo, T, Zs}; + /// use icu::datetime::fieldsets::{Combo, T, Zs}; /// use icu::timezone::{TimeZoneBcp47Id, UtcOffset, ZoneVariant}; /// use tinystr::tinystr; /// use icu::locale::locale; @@ -1332,7 +1309,6 @@ impl_zone_marker!( /// formatter.format(&time_zone_at_time); /// ``` Zs, - NeoTimeZoneStyle::Specific, description = "time zone in specific non-location format (only short)", sample_length = short, sample = "CDT", @@ -1354,7 +1330,7 @@ impl_zone_marker!( /// ``` /// use icu::calendar::{Date, Time}; /// use icu::datetime::TimeFormatter; - /// use icu::datetime::fieldset::O; + /// use icu::datetime::fieldsets::O; /// use icu::timezone::{TimeZoneBcp47Id, UtcOffset, ZoneVariant}; /// use tinystr::tinystr; /// use icu::locale::locale; @@ -1396,7 +1372,6 @@ impl_zone_marker!( /// ); /// ``` O, - NeoTimeZoneStyle::Offset, description = "UTC offset", sample_length = medium, sample = "GMT-5", @@ -1415,7 +1390,7 @@ impl_zone_marker!( /// use icu::timezone::{IxdtfParser, TimeZoneBcp47Id, TimeZoneInfo, UtcOffset, ZoneVariant}; /// use icu::calendar::Gregorian; /// use icu::datetime::FixedCalendarDateTimeFormatter; - /// use icu::datetime::fieldset::V; + /// use icu::datetime::fieldsets::V; /// use icu::locale::locale; /// use tinystr::tinystr; /// use writeable::assert_try_writeable_eq; @@ -1443,7 +1418,7 @@ impl_zone_marker!( /// use icu::calendar::{Date, Time}; /// use icu::timezone::{TimeZoneInfo, UtcOffset, TimeZoneIdMapper, TimeZoneBcp47Id}; /// use icu::datetime::TimeFormatter; - /// use icu::datetime::fieldset::V; + /// use icu::datetime::fieldsets::V; /// use icu::datetime::DateTimeWriteError; /// use icu::locale::locale; /// use tinystr::tinystr; @@ -1493,7 +1468,7 @@ impl_zone_marker!( /// ```compile_fail,E0271 /// use icu::calendar::{DateTime, Iso}; /// use icu::datetime::TimeFormatter; - /// use icu::datetime::fieldset::V; + /// use icu::datetime::fieldsets::V; /// use icu::timezone::{TimeZoneBcp47Id, UtcOffset}; /// use tinystr::tinystr; /// use icu::locale::locale; @@ -1512,7 +1487,6 @@ impl_zone_marker!( /// formatter.format(&time_zone_basic); /// ``` V, - NeoTimeZoneStyle::Generic, description = "time zone in generic non-location format", sample_length = long, sample = "Central Time", @@ -1536,7 +1510,7 @@ impl_zone_marker!( /// ```compile_fail,E0271 /// use icu::calendar::{DateTime, Iso}; /// use icu::datetime::FixedCalendarDateTimeFormatter; - /// use icu::datetime::fieldset::Vs; + /// use icu::datetime::fieldsets::Vs; /// use icu::timezone::{TimeZoneBcp47Id, UtcOffset}; /// use tinystr::tinystr; /// use icu::locale::locale; @@ -1555,7 +1529,6 @@ impl_zone_marker!( /// formatter.format(&time_zone_basic); /// ``` Vs, - NeoTimeZoneStyle::Generic, description = "time zone in generic non-location format (only short)", sample_length = short, sample = "CT", @@ -1578,7 +1551,7 @@ impl_zone_marker!( /// ```compile_fail,E0277 /// use icu::calendar::{DateTime, Iso}; /// use icu::datetime::FixedCalendarDateTimeFormatter; - /// use icu::datetime::fieldset::L; + /// use icu::datetime::fieldsets::L; /// use icu::timezone::UtcOffset; /// use tinystr::tinystr; /// use icu::locale::locale; @@ -1597,7 +1570,6 @@ impl_zone_marker!( /// formatter.format(&utc_offset); /// ``` L, - NeoTimeZoneStyle::Location, description = "time zone in location format", sample_length = long, sample = "Chicago Time", diff --git a/components/datetime/src/lib.rs b/components/datetime/src/lib.rs index 54cb8d91507..e0d8b2a4e13 100644 --- a/components/datetime/src/lib.rs +++ b/components/datetime/src/lib.rs @@ -10,7 +10,7 @@ //! ICU4X datetime formatting follows the Unicode UTS 35 standard for [Semantic Skeletons](https://unicode.org/reports/tr35/tr35-dates.html#Semantic_Skeletons). //! First you choose a _field set_, then you configure the formatting _options_ to your desired context. //! -//! 1. Field Sets: [`icu::datetime::fieldset`](fieldset) +//! 1. Field Sets: [`icu::datetime::fieldsets`](fieldsets) //! 2. Options: [`icu::datetime::options`](options) //! //! ICU4X supports formatting in over one dozen _calendar systems_, including Gregorian, Buddhist, @@ -41,7 +41,7 @@ //! //! | Factor | Static (Lower Binary Size) | Dynamic (Greater Binary Size) | //! |---|---|---| -//! | Field Sets | Specific [`fieldset`] types | Enumerations from [`fieldset::dynamic`] | +//! | Field Sets | Specific [`fieldsets`] types | Enumerations from [`fieldsets::enums`] | //! | Calendar Systems | [`FixedCalendarDateTimeFormatter`] | [`DateTimeFormatter`] | //! //! If formatting times and time zones without dates, consider using [`TimeFormatter`]. @@ -50,13 +50,13 @@ //! //! ``` //! use icu::calendar::DateTime; -//! use icu::datetime::fieldset; +//! use icu::datetime::fieldsets; //! use icu::datetime::DateTimeFormatter; //! use icu::locale::{locale, Locale}; //! use writeable::assert_try_writeable_eq; //! //! // Field set for year, month, day, hour, and minute with a medium length: -//! let field_set = fieldset::YMDT::medium().hm(); +//! let field_set = fieldsets::YMDT::medium().hm(); //! //! // Create a formatter for Argentinian Spanish: //! let locale = locale!("es-AR"); @@ -91,7 +91,7 @@ mod combo; mod error; mod external_loaders; pub mod fields; -pub mod fieldset; +pub mod fieldsets; mod format; pub mod input; mod neo; diff --git a/components/datetime/src/neo.rs b/components/datetime/src/neo.rs index 57e4e75b18f..0e0e662e901 100644 --- a/components/datetime/src/neo.rs +++ b/components/datetime/src/neo.rs @@ -5,7 +5,7 @@ //! High-level entrypoints for Neo DateTime Formatter use crate::external_loaders::*; -use crate::fieldset::dynamic::CompositeFieldSet; +use crate::fieldsets::enums::CompositeFieldSet; use crate::format::datetime::try_write_pattern_items; use crate::input::ExtractedInput; use crate::pattern::*; @@ -100,7 +100,7 @@ macro_rules! gen_any_buffer_constructors_with_external_loader { }; } -// impl RawNeoOptions { +// impl RawOptions { // pub(crate) fn from_field_set_and_locale(field_set: &FSet, locale: &DataLocale) -> Self // where // FSet: DateTimeMarkers, @@ -131,7 +131,7 @@ macro_rules! gen_any_buffer_constructors_with_external_loader { // } // } -size_test!(FixedCalendarDateTimeFormatter, typed_neo_year_month_day_formatter_size, 344); +size_test!(FixedCalendarDateTimeFormatter, typed_neo_year_month_day_formatter_size, 344); /// [`FixedCalendarDateTimeFormatter`] is a formatter capable of formatting dates and/or times from /// a calendar selected at compile time. @@ -168,7 +168,7 @@ where /// ``` /// use icu::calendar::Date; /// use icu::calendar::Gregorian; - /// use icu::datetime::fieldset::YMD; + /// use icu::datetime::fieldsets::YMD; /// use icu::datetime::FixedCalendarDateTimeFormatter; /// use icu::locale::locale; /// use writeable::assert_try_writeable_eq; @@ -302,7 +302,7 @@ where /// use icu::calendar::Date; /// use icu::calendar::cal::Buddhist; /// use icu::datetime::FixedCalendarDateTimeFormatter; - /// use icu::datetime::fieldset::YMD; + /// use icu::datetime::fieldsets::YMD; /// use icu::locale::locale; /// /// let formatter = @@ -322,7 +322,7 @@ where /// use icu::calendar::Time; /// use icu::calendar::Gregorian; /// use icu::datetime::FixedCalendarDateTimeFormatter; - /// use icu::datetime::fieldset::YMD; + /// use icu::datetime::fieldsets::YMD; /// use icu::locale::locale; /// /// let formatter = @@ -350,7 +350,7 @@ where } size_test!( - DateTimeFormatter, + DateTimeFormatter, neo_year_month_day_formatter_size, 400 ); @@ -396,7 +396,7 @@ where /// /// ``` /// use icu::calendar::{any_calendar::AnyCalendar, DateTime}; - /// use icu::datetime::fieldset::YMD; + /// use icu::datetime::fieldsets::YMD; /// use icu::datetime::DateTimeFormatter; /// use icu::locale::locale; /// use std::str::FromStr; @@ -536,7 +536,7 @@ where /// /// ``` /// use icu::calendar::Date; - /// use icu::datetime::fieldset::YMD; + /// use icu::datetime::fieldsets::YMD; /// use icu::datetime::DateTimeFormatter; /// use icu::datetime::MismatchedCalendarError; /// use icu::locale::locale; @@ -560,7 +560,7 @@ where /// ```compile_fail /// use icu::calendar::Time; /// use icu::datetime::DateTimeFormatter; - /// use icu::datetime::fieldset::YMD; + /// use icu::datetime::fieldsets::YMD; /// use icu::locale::locale; /// /// let formatter = DateTimeFormatter::try_new( @@ -599,7 +599,7 @@ where /// /// ``` /// use icu::calendar::Date; - /// use icu::datetime::fieldset::YMD; + /// use icu::datetime::fieldsets::YMD; /// use icu::datetime::DateTimeFormatter; /// use icu::datetime::MismatchedCalendarError; /// use icu::locale::locale; @@ -624,7 +624,7 @@ where /// ```compile_fail /// use icu::calendar::Time; /// use icu::datetime::DateTimeFormatter; - /// use icu::datetime::fieldset::YMD; + /// use icu::datetime::fieldsets::YMD; /// use icu::locale::locale; /// /// let formatter = DateTimeFormatter::try_new( @@ -666,7 +666,7 @@ impl FixedCalendarDateTimeFormatter DateTimeFormatter { /// ``` /// use icu::calendar::cal::Hebrew; /// use icu::calendar::Date; - /// use icu::datetime::fieldset::YMD; + /// use icu::datetime::fieldsets::YMD; /// use icu::datetime::DateTimeFormatter; /// use icu::locale::locale; /// use writeable::assert_try_writeable_eq; @@ -730,7 +730,7 @@ impl DateTimeFormatter { /// ``` /// use icu::calendar::cal::Hebrew; /// use icu::calendar::Date; - /// use icu::datetime::fieldset::YMD; + /// use icu::datetime::fieldsets::YMD; /// use icu::datetime::DateTimeFormatter; /// use icu::datetime::MismatchedCalendarError; /// use icu::locale::locale; @@ -772,7 +772,7 @@ impl DateTimeFormatter { /// /// ``` /// use icu::datetime::TimeFormatter; -/// use icu::datetime::fieldset::Y; +/// use icu::datetime::fieldsets::Y; /// use icu::locale::locale; /// /// assert!(TimeFormatter::try_new(&locale!("und").into(), Y::medium()).is_err()); @@ -782,7 +782,7 @@ impl DateTimeFormatter { /// /// ```compile_fail,E0271 /// use icu::datetime::TimeFormatter; -/// use icu::datetime::fieldset::Y; +/// use icu::datetime::fieldsets::Y; /// use icu::locale::locale; /// /// let date: icu::calendar::Date = unimplemented!(); diff --git a/components/datetime/src/neo_serde.rs b/components/datetime/src/neo_serde.rs index 6e6b9b9a649..2748aed9183 100644 --- a/components/datetime/src/neo_serde.rs +++ b/components/datetime/src/neo_serde.rs @@ -5,9 +5,9 @@ //! Serde definitions for semantic skeleta use crate::{ - fieldset::{self, dynamic::*}, + fieldsets::{self, enums::*}, options::*, - raw::neo::RawNeoOptions, + raw::neo::RawOptions, }; use alloc::vec::Vec; use serde::{Deserialize, Serialize}; @@ -48,12 +48,12 @@ pub enum CompositeFieldSetSerdeError { /// # Examples /// /// ``` -/// use icu::datetime::fieldset; -/// use icu::datetime::fieldset::dynamic::CompositeFieldSet; -/// use icu::datetime::fieldset::dynamic::DateFieldSet; -/// use icu::datetime::fieldset::serde::CompositeFieldSetSerde; +/// use icu::datetime::fieldsets; +/// use icu::datetime::fieldsets::enums::CompositeFieldSet; +/// use icu::datetime::fieldsets::enums::DateFieldSet; +/// use icu::datetime::fieldsets::serde::CompositeFieldSetSerde; /// -/// let field_set = CompositeFieldSet::Date(DateFieldSet::YMD(fieldset::YMD::short())); +/// let field_set = CompositeFieldSet::Date(DateFieldSet::YMD(fieldsets::YMD::short())); /// let serde_input = CompositeFieldSetSerde::from(field_set); /// /// let json_string = serde_json::to_string(&serde_input).unwrap(); @@ -71,9 +71,9 @@ pub enum CompositeFieldSetSerdeError { /// If the field set is invalid, an error will occur: /// /// ``` -/// use icu::datetime::fieldset::dynamic::CompositeFieldSet; -/// use icu::datetime::fieldset::serde::CompositeFieldSetSerde; -/// use icu::datetime::fieldset::serde::CompositeFieldSetSerdeError; +/// use icu::datetime::fieldsets::enums::CompositeFieldSet; +/// use icu::datetime::fieldsets::serde::CompositeFieldSetSerde; +/// use icu::datetime::fieldsets::serde::CompositeFieldSetSerdeError; /// /// let json_string = r#"{"fieldSet":["year","time"],"length":"short"}"#; /// let serde_output = serde_json::from_str::(&json_string).unwrap(); @@ -155,7 +155,7 @@ impl TryFrom for CompositeFieldSet { let date = value.field_set.date_only(); let time = value.field_set.time_only(); let zone = value.field_set.zone_only(); - let options = RawNeoOptions { + let options = RawOptions { length: value.length, alignment: value.alignment, year_style: value.year_style, @@ -465,7 +465,7 @@ impl<'de> Deserialize<'de> for FieldSetSerde { } impl FieldSetSerde { - fn from_date_field_set(value: DateFieldSet) -> (Self, RawNeoOptions) { + fn from_date_field_set(value: DateFieldSet) -> (Self, RawOptions) { match value { DateFieldSet::D(v) => (Self::DAY, v.to_raw_options()), DateFieldSet::MD(v) => (Self::MONTH_DAY, v.to_raw_options()), @@ -477,21 +477,21 @@ impl FieldSetSerde { } } - fn to_date_field_set(self, options: RawNeoOptions) -> Option { + fn to_date_field_set(self, options: RawOptions) -> Option { use DateFieldSet::*; match self { - Self::DAY => Some(D(fieldset::D::from_raw_options(options))), - Self::MONTH_DAY => Some(MD(fieldset::MD::from_raw_options(options))), - Self::YEAR_MONTH_DAY => Some(YMD(fieldset::YMD::from_raw_options(options))), - Self::DAY_WEEKDAY => Some(DE(fieldset::DE::from_raw_options(options))), - Self::MONTH_DAY_WEEKDAY => Some(MDE(fieldset::MDE::from_raw_options(options))), - Self::YEAR_MONTH_DAY_WEEKDAY => Some(YMDE(fieldset::YMDE::from_raw_options(options))), - Self::WEEKDAY => Some(E(fieldset::E::from_raw_options(options))), + Self::DAY => Some(D(fieldsets::D::from_raw_options(options))), + Self::MONTH_DAY => Some(MD(fieldsets::MD::from_raw_options(options))), + Self::YEAR_MONTH_DAY => Some(YMD(fieldsets::YMD::from_raw_options(options))), + Self::DAY_WEEKDAY => Some(DE(fieldsets::DE::from_raw_options(options))), + Self::MONTH_DAY_WEEKDAY => Some(MDE(fieldsets::MDE::from_raw_options(options))), + Self::YEAR_MONTH_DAY_WEEKDAY => Some(YMDE(fieldsets::YMDE::from_raw_options(options))), + Self::WEEKDAY => Some(E(fieldsets::E::from_raw_options(options))), _ => None, } } - fn from_calendar_period_field_set(value: CalendarPeriodFieldSet) -> (Self, RawNeoOptions) { + fn from_calendar_period_field_set(value: CalendarPeriodFieldSet) -> (Self, RawOptions) { match value { CalendarPeriodFieldSet::M(v) => (Self::MONTH, v.to_raw_options()), CalendarPeriodFieldSet::YM(v) => (Self::YEAR_MONTH, v.to_raw_options()), @@ -499,29 +499,26 @@ impl FieldSetSerde { } } - fn to_calendar_period_field_set( - self, - options: RawNeoOptions, - ) -> Option { + fn to_calendar_period_field_set(self, options: RawOptions) -> Option { use CalendarPeriodFieldSet::*; match self { - Self::MONTH => Some(M(fieldset::M::from_raw_options(options))), - Self::YEAR_MONTH => Some(YM(fieldset::YM::from_raw_options(options))), - Self::YEAR => Some(Y(fieldset::Y::from_raw_options(options))), + Self::MONTH => Some(M(fieldsets::M::from_raw_options(options))), + Self::YEAR_MONTH => Some(YM(fieldsets::YM::from_raw_options(options))), + Self::YEAR => Some(Y(fieldsets::Y::from_raw_options(options))), _ => None, } } - fn from_time_field_set(value: TimeFieldSet) -> (Self, RawNeoOptions) { + fn from_time_field_set(value: TimeFieldSet) -> (Self, RawOptions) { match value { TimeFieldSet::T(v) => (Self::TIME, v.to_raw_options()), } } - fn to_time_field_set(self, options: RawNeoOptions) -> Option { + fn to_time_field_set(self, options: RawOptions) -> Option { use TimeFieldSet::*; match self { - Self::TIME => Some(T(fieldset::T::from_raw_options(options))), + Self::TIME => Some(T(fieldsets::T::from_raw_options(options))), _ => None, } } @@ -545,7 +542,7 @@ impl FieldSetSerde { } } - fn from_zone_field_set(value: ZoneFieldSet) -> (Self, RawNeoOptions) { + fn from_zone_field_set(value: ZoneFieldSet) -> (Self, RawOptions) { match value { ZoneFieldSet::Z(v) => (Self::ZONE_SPECIFIC, v.to_raw_options()), ZoneFieldSet::O(v) => (Self::ZONE_OFFSET, v.to_raw_options()), @@ -554,13 +551,13 @@ impl FieldSetSerde { } } - fn to_zone_field_set(self, options: RawNeoOptions) -> Option { + fn to_zone_field_set(self, options: RawOptions) -> Option { use ZoneFieldSet::*; match self { - Self::ZONE_SPECIFIC => Some(Z(fieldset::Z::from_raw_options(options))), - Self::ZONE_OFFSET => Some(O(fieldset::O::from_raw_options(options))), - Self::ZONE_GENERIC => Some(V(fieldset::V::from_raw_options(options))), - Self::ZONE_LOCATION => Some(L(fieldset::L::from_raw_options(options))), + Self::ZONE_SPECIFIC => Some(Z(fieldsets::Z::from_raw_options(options))), + Self::ZONE_OFFSET => Some(O(fieldsets::O::from_raw_options(options))), + Self::ZONE_GENERIC => Some(V(fieldsets::V::from_raw_options(options))), + Self::ZONE_LOCATION => Some(L(fieldsets::L::from_raw_options(options))), _ => None, } } @@ -569,7 +566,7 @@ impl FieldSetSerde { #[test] fn test_basic() { let skeleton = CompositeFieldSet::DateTimeZone( - DateAndTimeFieldSet::YMDET(fieldset::YMDET { + DateAndTimeFieldSet::YMDET(fieldsets::YMDET { length: NeoSkeletonLength::Medium, alignment: Some(Alignment::Column), year_style: Some(YearStyle::Always), diff --git a/components/datetime/src/options/mod.rs b/components/datetime/src/options/mod.rs index 2678997e55c..6fe5c1f11ec 100644 --- a/components/datetime/src/options/mod.rs +++ b/components/datetime/src/options/mod.rs @@ -20,7 +20,7 @@ use crate::neo_serde::TimePrecisionSerde; /// ``` /// use icu::calendar::Date; /// use icu::calendar::Gregorian; -/// use icu::datetime::fieldset::YMD; +/// use icu::datetime::fieldsets::YMD; /// use icu::datetime::FixedCalendarDateTimeFormatter; /// use icu::locale::locale; /// use writeable::assert_try_writeable_eq; @@ -99,7 +99,7 @@ impl IntoOption for NeoSkeletonLength { /// ``` /// use icu::calendar::Date; /// use icu::calendar::Gregorian; -/// use icu::datetime::fieldset::YMD; +/// use icu::datetime::fieldsets::YMD; /// use icu::datetime::options::Alignment; /// use icu::datetime::FixedCalendarDateTimeFormatter; /// use icu::locale::locale; @@ -173,7 +173,7 @@ impl IntoOption for Alignment { /// ``` /// use icu::calendar::Date; /// use icu::calendar::Gregorian; -/// use icu::datetime::fieldset::YMD; +/// use icu::datetime::fieldsets::YMD; /// use icu::datetime::options::YearStyle; /// use icu::datetime::FixedCalendarDateTimeFormatter; /// use icu::locale::locale; @@ -324,7 +324,7 @@ impl IntoOption for YearStyle { /// /// ``` /// use icu::calendar::Time; -/// use icu::datetime::fieldset::T; +/// use icu::datetime::fieldsets::T; /// use icu::datetime::options::FractionalSecondDigits; /// use icu::datetime::options::TimePrecision; /// use icu::datetime::FixedCalendarDateTimeFormatter; @@ -459,7 +459,7 @@ impl IntoOption for TimePrecision { /// ``` /// use icu::calendar::Gregorian; /// use icu::calendar::Time; -/// use icu::datetime::fieldset::T; +/// use icu::datetime::fieldsets::T; /// use icu::datetime::options::FractionalSecondDigits; /// use icu::datetime::options::TimePrecision; /// use icu::datetime::FixedCalendarDateTimeFormatter; diff --git a/components/datetime/src/pattern/formatter.rs b/components/datetime/src/pattern/formatter.rs index fcda4c4fed3..475ef7666da 100644 --- a/components/datetime/src/pattern/formatter.rs +++ b/components/datetime/src/pattern/formatter.rs @@ -196,7 +196,7 @@ where /// ``` /// use icu::calendar::Gregorian; /// use icu::datetime::pattern::DateTimePattern; - /// use icu::datetime::fieldset::dynamic::ZoneFieldSet; + /// use icu::datetime::fieldsets::enums::ZoneFieldSet; /// use icu::datetime::pattern::TypedDateTimeNames; /// use icu::locale::locale; /// use icu::timezone::IxdtfParser; diff --git a/components/datetime/src/pattern/names.rs b/components/datetime/src/pattern/names.rs index f9f02569b4a..0dabdb5d7f5 100644 --- a/components/datetime/src/pattern/names.rs +++ b/components/datetime/src/pattern/names.rs @@ -9,7 +9,7 @@ use super::{ }; use crate::external_loaders::*; use crate::fields::{self, FieldLength, FieldSymbol}; -use crate::fieldset::dynamic::CompositeDateTimeFieldSet; +use crate::fieldsets::enums::CompositeDateTimeFieldSet; use crate::input; use crate::provider::neo::*; use crate::provider::pattern::PatternItem; @@ -49,8 +49,8 @@ size_test!( /// /// To support all fields including time zones, use [`CompositeFieldSet`]. /// -/// [`CompositeFieldSet`]: crate::fieldset::dynamic::CompositeFieldSet -/// [`CompositeDateTimeFieldSet`]: crate::fieldset::dynamic::CompositeDateTimeFieldSet +/// [`CompositeFieldSet`]: crate::fieldsets::enums::CompositeFieldSet +/// [`CompositeDateTimeFieldSet`]: crate::fieldsets::enums::CompositeDateTimeFieldSet /// /// # Examples /// @@ -93,7 +93,7 @@ size_test!( /// use icu::datetime::pattern::TypedDateTimeNames; /// use icu::datetime::fields::{Field, FieldLength, FieldSymbol, Weekday}; /// use icu::datetime::pattern::DateTimePattern; -/// use icu::datetime::fieldset::dynamic::CompositeFieldSet; +/// use icu::datetime::fieldsets::enums::CompositeFieldSet; /// use icu::locale::locale; /// use icu::timezone::{TimeZoneInfo, IxdtfParser}; /// use writeable::{Part, assert_try_writeable_parts_eq}; @@ -135,7 +135,7 @@ size_test!( /// use icu::datetime::pattern::TypedDateTimeNames; /// use icu::datetime::fields::{Field, FieldLength, FieldSymbol, Weekday}; /// use icu::datetime::pattern::DateTimePattern; -/// use icu::datetime::fieldset::O; +/// use icu::datetime::fieldsets::O; /// use icu::locale::locale; /// use icu::timezone::TimeZoneInfo; /// use writeable::{Part, assert_try_writeable_parts_eq}; @@ -295,7 +295,7 @@ impl TypedDateTimeNames { /// use icu::datetime::pattern::TypedDateTimeNames; /// use icu::datetime::fields::{Field, FieldLength, FieldSymbol, Weekday}; /// use icu::datetime::pattern::DateTimePattern; - /// use icu::datetime::fieldset::dynamic::DateFieldSet; + /// use icu::datetime::fieldsets::enums::DateFieldSet; /// use icu::locale::locale; /// use writeable::{Part, assert_try_writeable_parts_eq}; /// @@ -616,7 +616,7 @@ impl TypedDateTimeNames { /// ``` /// use icu::calendar::Gregorian; /// use icu::datetime::pattern::DateTimePattern; - /// use icu::datetime::fieldset::dynamic::ZoneFieldSet; + /// use icu::datetime::fieldsets::enums::ZoneFieldSet; /// use icu::datetime::pattern::TypedDateTimeNames; /// use icu::locale::locale; /// use icu::timezone::IxdtfParser; @@ -719,7 +719,7 @@ impl TypedDateTimeNames { /// ``` /// use icu::calendar::Gregorian; /// use icu::datetime::pattern::DateTimePattern; - /// use icu::datetime::fieldset::dynamic::ZoneFieldSet; + /// use icu::datetime::fieldsets::enums::ZoneFieldSet; /// use icu::datetime::pattern::TypedDateTimeNames; /// use icu::locale::locale; /// use icu::timezone::IxdtfParser; @@ -786,7 +786,7 @@ impl TypedDateTimeNames { /// ``` /// use icu::calendar::Gregorian; /// use icu::datetime::pattern::DateTimePattern; - /// use icu::datetime::fieldset::dynamic::ZoneFieldSet; + /// use icu::datetime::fieldsets::enums::ZoneFieldSet; /// use icu::datetime::pattern::TypedDateTimeNames; /// use icu::locale::locale; /// use icu::timezone::IxdtfParser; @@ -862,7 +862,7 @@ impl TypedDateTimeNames { /// ``` /// use icu::calendar::Gregorian; /// use icu::datetime::pattern::DateTimePattern; - /// use icu::datetime::fieldset::dynamic::ZoneFieldSet; + /// use icu::datetime::fieldsets::enums::ZoneFieldSet; /// use icu::datetime::pattern::TypedDateTimeNames; /// use icu::locale::locale; /// use icu::timezone::IxdtfParser; @@ -938,7 +938,7 @@ impl TypedDateTimeNames { /// ``` /// use icu::calendar::Gregorian; /// use icu::datetime::pattern::DateTimePattern; - /// use icu::datetime::fieldset::dynamic::ZoneFieldSet; + /// use icu::datetime::fieldsets::enums::ZoneFieldSet; /// use icu::datetime::pattern::TypedDateTimeNames; /// use icu::locale::locale; /// use icu::timezone::IxdtfParser; @@ -1014,7 +1014,7 @@ impl TypedDateTimeNames { /// ``` /// use icu::calendar::Gregorian; /// use icu::datetime::pattern::DateTimePattern; - /// use icu::datetime::fieldset::dynamic::ZoneFieldSet; + /// use icu::datetime::fieldsets::enums::ZoneFieldSet; /// use icu::datetime::pattern::TypedDateTimeNames; /// use icu::locale::locale; /// use icu::timezone::IxdtfParser; @@ -1079,7 +1079,7 @@ impl TypedDateTimeNames { /// ``` /// use icu::calendar::Time; /// use icu::datetime::pattern::DateTimePattern; - /// use icu::datetime::fieldset::dynamic::TimeFieldSet; + /// use icu::datetime::fieldsets::enums::TimeFieldSet; /// use icu::datetime::pattern::TypedDateTimeNames; /// use icu::locale::locale; /// use writeable::assert_try_writeable_eq; diff --git a/components/datetime/src/pattern/pattern.rs b/components/datetime/src/pattern/pattern.rs index 6d05df49827..4c4f50dd0c1 100644 --- a/components/datetime/src/pattern/pattern.rs +++ b/components/datetime/src/pattern/pattern.rs @@ -38,7 +38,7 @@ size_test!(DateTimePattern, date_time_pattern_size, 32); /// ``` /// use icu::calendar::Date; /// use icu::calendar::Gregorian; -/// use icu::datetime::fieldset::YMD; +/// use icu::datetime::fieldsets::YMD; /// use icu::datetime::pattern::DateTimePattern; /// use icu::datetime::fields::components; /// use icu::datetime::FixedCalendarDateTimeFormatter; diff --git a/components/datetime/src/raw/neo.rs b/components/datetime/src/raw/neo.rs index 63f2d7c90c6..5a49e93cae2 100644 --- a/components/datetime/src/raw/neo.rs +++ b/components/datetime/src/raw/neo.rs @@ -3,7 +3,7 @@ // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). use crate::fields::{self, Field, FieldLength, FieldSymbol, TimeZone}; -use crate::fieldset::dynamic::{CompositeFieldSet, TimeFieldSet, ZoneFieldSet}; +use crate::fieldsets::enums::{CompositeFieldSet, TimeFieldSet, ZoneFieldSet}; use crate::input::ExtractedInput; use crate::options::*; use crate::pattern::DateTimePattern; @@ -19,16 +19,16 @@ use zerovec::ule::AsULE; use zerovec::ZeroSlice; #[derive(Debug, Copy, Clone)] -pub(crate) struct RawNeoOptions { +pub(crate) struct RawOptions { pub(crate) length: NeoSkeletonLength, pub(crate) alignment: Option, pub(crate) year_style: Option, pub(crate) time_precision: Option, } -impl RawNeoOptions { +impl RawOptions { #[cfg(all(feature = "serde", feature = "experimental"))] - pub(crate) fn merge(self, other: RawNeoOptions) -> Self { + pub(crate) fn merge(self, other: RawOptions) -> Self { Self { length: self.length, alignment: self.alignment.or(other.alignment), @@ -46,7 +46,7 @@ pub(crate) struct RawPreferences { #[derive(Debug)] pub(crate) enum DatePatternSelectionData { SkeletonDate { - options: RawNeoOptions, + options: RawOptions, payload: DataPayload, }, // TODO(#4478): add support for optional eras @@ -64,7 +64,7 @@ pub(crate) enum DatePatternDataBorrowed<'a> { #[derive(Debug)] pub(crate) enum OverlapPatternSelectionData { SkeletonDateTime { - options: RawNeoOptions, + options: RawOptions, prefs: RawPreferences, payload: DataPayload, }, @@ -73,7 +73,7 @@ pub(crate) enum OverlapPatternSelectionData { #[derive(Debug)] pub(crate) enum TimePatternSelectionData { SkeletonTime { - options: RawNeoOptions, + options: RawOptions, prefs: RawPreferences, payload: DataPayload, }, @@ -183,7 +183,7 @@ impl DatePatternSelectionData { provider: &(impl BoundDataProvider + ?Sized), locale: &DataLocale, attributes: &DataMarkerAttributes, - options: RawNeoOptions, + options: RawOptions, ) -> Result { let payload = provider .load_bound(DataRequest { @@ -285,7 +285,7 @@ impl OverlapPatternSelectionData { provider: &(impl BoundDataProvider + ?Sized), locale: &DataLocale, attributes: &DataMarkerAttributes, - options: RawNeoOptions, + options: RawOptions, prefs: RawPreferences, ) -> Result { let payload = provider @@ -351,7 +351,7 @@ impl TimePatternSelectionData { provider: &(impl BoundDataProvider + ?Sized), locale: &DataLocale, components: TimeFieldSet, - options: RawNeoOptions, + options: RawOptions, prefs: RawPreferences, ) -> Result { // First try to load with the explicit hour cycle. If there is no explicit hour cycle, @@ -628,7 +628,7 @@ impl DateTimeZonePatternSelectionData { fn load_glue( glue_provider: &(impl BoundDataProvider + ?Sized), locale: &DataLocale, - options: RawNeoOptions, + options: RawOptions, glue_type: GlueType, ) -> Result, DataError> { glue_provider diff --git a/components/datetime/src/scaffold/dynamic_impls.rs b/components/datetime/src/scaffold/dynamic_impls.rs index d8c13930c62..58f0db5d777 100644 --- a/components/datetime/src/scaffold/dynamic_impls.rs +++ b/components/datetime/src/scaffold/dynamic_impls.rs @@ -3,7 +3,7 @@ // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). use super::*; -use crate::fieldset::dynamic::*; +use crate::fieldsets::enums::*; use crate::provider::{neo::*, time_zones::tz, *}; use icu_calendar::{ types::{ diff --git a/components/datetime/tests/datetime.rs b/components/datetime/tests/datetime.rs index 1581e56c297..cbd6df2dddf 100644 --- a/components/datetime/tests/datetime.rs +++ b/components/datetime/tests/datetime.rs @@ -15,7 +15,7 @@ use icu_calendar::{ any_calendar::{AnyCalendarKind, IntoAnyCalendar}, AsCalendar, Calendar, DateTime, }; -use icu_datetime::fieldset::dynamic::*; +use icu_datetime::fieldsets::enums::*; use icu_datetime::scaffold::CldrCalendar; use icu_datetime::{ pattern::DateTimePattern, pattern::TypedDateTimeNames, DateTimeFormatter, @@ -455,7 +455,7 @@ fn test_time_zone_format_configs() { #[test] fn test_time_zone_format_offset_seconds() { - use icu_datetime::fieldset::O; + use icu_datetime::fieldsets::O; let tzf = FixedCalendarDateTimeFormatter::<(), _>::try_new(&locale!("en").into(), O::medium()) .unwrap(); @@ -467,7 +467,7 @@ fn test_time_zone_format_offset_seconds() { #[test] fn test_time_zone_format_offset_fallback() { - use icu_datetime::fieldset::O; + use icu_datetime::fieldsets::O; let tzf = FixedCalendarDateTimeFormatter::<(), _>::try_new(&locale!("en").into(), O::medium()) .unwrap(); diff --git a/components/datetime/tests/fixtures/mod.rs b/components/datetime/tests/fixtures/mod.rs index 85a55f59591..9dd7e789f8e 100644 --- a/components/datetime/tests/fixtures/mod.rs +++ b/components/datetime/tests/fixtures/mod.rs @@ -5,7 +5,7 @@ #![cfg(feature = "serde")] use icu_datetime::fields::components; -use icu_datetime::{fieldset::serde::CompositeFieldSetSerde, options}; +use icu_datetime::{fieldsets::serde::CompositeFieldSetSerde, options}; use icu_locale_core::preferences::extensions::unicode::keywords::HourCycle; use serde::{Deserialize, Serialize}; use std::collections::HashMap; diff --git a/components/datetime/tests/patterns/time_zones.rs b/components/datetime/tests/patterns/time_zones.rs index 43b8b45f8e5..91d97bb434f 100644 --- a/components/datetime/tests/patterns/time_zones.rs +++ b/components/datetime/tests/patterns/time_zones.rs @@ -3,7 +3,7 @@ // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). use icu_datetime::{ - fieldset::{self, dynamic::ZoneFieldSet}, + fieldsets::{self, enums::ZoneFieldSet}, options::NeoSkeletonLength, }; use serde::{Deserialize, Serialize}; @@ -21,13 +21,13 @@ pub struct TimeZoneTest { pub fn pattern_to_semantic_skeleton(p: &str) -> Option { Some(match p { - "vvvv" => ZoneFieldSet::V(fieldset::V::with_length(NeoSkeletonLength::Long)), - "v" => ZoneFieldSet::V(fieldset::V::with_length(NeoSkeletonLength::Short)), - "VVVV" => ZoneFieldSet::L(fieldset::L::with_length(NeoSkeletonLength::Long)), - "zzzz" => ZoneFieldSet::Z(fieldset::Z::with_length(NeoSkeletonLength::Long)), - "z" => ZoneFieldSet::Z(fieldset::Z::with_length(NeoSkeletonLength::Short)), - "OOOO" => ZoneFieldSet::O(fieldset::O::with_length(NeoSkeletonLength::Long)), - "O" => ZoneFieldSet::O(fieldset::O::with_length(NeoSkeletonLength::Short)), + "vvvv" => ZoneFieldSet::V(fieldsets::V::with_length(NeoSkeletonLength::Long)), + "v" => ZoneFieldSet::V(fieldsets::V::with_length(NeoSkeletonLength::Short)), + "VVVV" => ZoneFieldSet::L(fieldsets::L::with_length(NeoSkeletonLength::Long)), + "zzzz" => ZoneFieldSet::Z(fieldsets::Z::with_length(NeoSkeletonLength::Long)), + "z" => ZoneFieldSet::Z(fieldsets::Z::with_length(NeoSkeletonLength::Short)), + "OOOO" => ZoneFieldSet::O(fieldsets::O::with_length(NeoSkeletonLength::Long)), + "O" => ZoneFieldSet::O(fieldsets::O::with_length(NeoSkeletonLength::Short)), _ => return None, }) } diff --git a/components/datetime/tests/resolved_components.rs b/components/datetime/tests/resolved_components.rs index b53f6b2ef76..cc4115552b6 100644 --- a/components/datetime/tests/resolved_components.rs +++ b/components/datetime/tests/resolved_components.rs @@ -5,10 +5,7 @@ use icu_calendar::{Date, DateTime, Gregorian, Time}; use icu_datetime::{ fields::components, - fieldset::{ - self, - dynamic::{CompositeDateTimeFieldSet, DateAndTimeFieldSet, DateFieldSet, TimeFieldSet}, - }, + fieldsets::{self, enums::*}, options::{Alignment, FractionalSecondDigits, TimePrecision, YearStyle}, FixedCalendarDateTimeFormatter, }; @@ -32,7 +29,7 @@ fn assert_resolved_components( #[test] fn test_length_date() { - let skeleton = CompositeDateTimeFieldSet::Date(DateFieldSet::YMD(fieldset::YMD::medium())); + let skeleton = CompositeDateTimeFieldSet::Date(DateFieldSet::YMD(fieldsets::YMD::medium())); let mut components_bag = components::Bag::default(); components_bag.year = Some(components::Year::Numeric); @@ -44,7 +41,7 @@ fn test_length_date() { #[test] fn test_length_time() { - let skeleton = CompositeDateTimeFieldSet::Time(TimeFieldSet::T(fieldset::T::medium().hms())); + let skeleton = CompositeDateTimeFieldSet::Time(TimeFieldSet::T(fieldsets::T::medium())); let mut components_bag = components::Bag::default(); components_bag.hour = Some(components::Numeric::Numeric); @@ -62,9 +59,7 @@ fn test_length_time() { #[test] fn test_length_time_preferences() { let skeleton = CompositeDateTimeFieldSet::Time(TimeFieldSet::T( - fieldset::T::medium() - .hms() - .with_alignment(Alignment::Column), + fieldsets::T::medium().with_alignment(Alignment::Column), )); let mut components_bag = components::Bag::default(); @@ -83,7 +78,7 @@ fn test_length_time_preferences() { #[test] fn test_date_and_time() { let skeleton = CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::YMDET( - fieldset::YMDET::medium() + fieldsets::YMDET::medium() .with_year_style(YearStyle::Always) .with_alignment(Alignment::Column) .with_time_precision(TimePrecision::SecondExact(FractionalSecondDigits::F4)), diff --git a/components/datetime/tests/simple_test.rs b/components/datetime/tests/simple_test.rs index a44fa60ebb9..f89b9c521f3 100644 --- a/components/datetime/tests/simple_test.rs +++ b/components/datetime/tests/simple_test.rs @@ -4,10 +4,10 @@ use icu_calendar::cal::Hebrew; use icu_calendar::{Date, DateTime, Time}; -use icu_datetime::fieldset::dynamic::{ +use icu_datetime::fieldsets::enums::{ CompositeDateTimeFieldSet, DateAndTimeFieldSet, DateFieldSet, }; -use icu_datetime::fieldset::{self, YMD}; +use icu_datetime::fieldsets::{self, YMD}; use icu_datetime::FixedCalendarDateTimeFormatter; use icu_locale_core::{locale, Locale}; use writeable::assert_try_writeable_eq; @@ -71,14 +71,14 @@ fn neo_datetime_lengths() { let datetime = DateTime::try_new_gregorian(2023, 12, 22, 21, 22, 53).unwrap(); let mut expected_iter = EXPECTED_DATETIME.iter(); for field_set in [ - DateAndTimeFieldSet::YMDET(fieldset::YMDET::long()), - DateAndTimeFieldSet::YMDET(fieldset::YMDET::long().hm()), - DateAndTimeFieldSet::YMDT(fieldset::YMDT::long()), - DateAndTimeFieldSet::YMDT(fieldset::YMDT::long().hm()), - DateAndTimeFieldSet::YMDT(fieldset::YMDT::medium()), - DateAndTimeFieldSet::YMDT(fieldset::YMDT::medium().hm()), - DateAndTimeFieldSet::YMDT(fieldset::YMDT::short()), - DateAndTimeFieldSet::YMDT(fieldset::YMDT::short().hm()), + DateAndTimeFieldSet::YMDET(fieldsets::YMDET::long()), + DateAndTimeFieldSet::YMDET(fieldsets::YMDET::long().hm()), + DateAndTimeFieldSet::YMDT(fieldsets::YMDT::long()), + DateAndTimeFieldSet::YMDT(fieldsets::YMDT::long().hm()), + DateAndTimeFieldSet::YMDT(fieldsets::YMDT::medium()), + DateAndTimeFieldSet::YMDT(fieldsets::YMDT::medium().hm()), + DateAndTimeFieldSet::YMDT(fieldsets::YMDT::short()), + DateAndTimeFieldSet::YMDT(fieldsets::YMDT::short().hm()), ] { for locale in [ locale!("en").into(), @@ -100,10 +100,10 @@ fn neo_date_lengths() { let datetime = DateTime::try_new_gregorian(2023, 12, 22, 21, 22, 53).unwrap(); let mut expected_iter = EXPECTED_DATE.iter(); for field_set in [ - DateFieldSet::YMDE(fieldset::YMDE::long()), - DateFieldSet::YMD(fieldset::YMD::long()), - DateFieldSet::YMD(fieldset::YMD::medium()), - DateFieldSet::YMD(fieldset::YMD::short()), + DateFieldSet::YMDE(fieldsets::YMDE::long()), + DateFieldSet::YMD(fieldsets::YMD::long()), + DateFieldSet::YMD(fieldsets::YMD::medium()), + DateFieldSet::YMD(fieldsets::YMD::short()), ] { let date_skeleton = CompositeDateTimeFieldSet::Date(field_set); for locale in [ @@ -137,14 +137,14 @@ fn overlap_patterns() { TestCase { locale: locale!("en-US"), skeleton: CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::ET( - fieldset::ET::medium(), + fieldsets::ET::medium(), )), expected: "Fri 8:40:07\u{202f}PM", }, TestCase { locale: locale!("en-US"), skeleton: CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::MDET( - fieldset::MDET::medium(), + fieldsets::MDET::medium(), )), expected: "Fri, Aug 9, 8:40:07\u{202f}PM", }, @@ -153,13 +153,13 @@ fn overlap_patterns() { TestCase { locale: locale!("ru"), skeleton: CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::ET( - fieldset::ET::medium(), + fieldsets::ET::medium(), )), expected: "пт 20:40:07", }, TestCase { locale: locale!("ru"), - skeleton: CompositeDateTimeFieldSet::Date(DateFieldSet::E(fieldset::E::medium())), + skeleton: CompositeDateTimeFieldSet::Date(DateFieldSet::E(fieldsets::E::medium())), expected: "пт", }, ]; @@ -193,17 +193,17 @@ fn test_5387() { let datetime = DateTime::try_new_gregorian(2024, 8, 16, 14, 15, 16).unwrap(); let formatter_auto = FixedCalendarDateTimeFormatter::try_new( &locale!("en").into(), - CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::ET(fieldset::ET::medium())), + CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::ET(fieldsets::ET::medium())), ) .unwrap(); let formatter_h12 = FixedCalendarDateTimeFormatter::try_new( &locale!("en-u-hc-h12").into(), - CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::ET(fieldset::ET::medium())), + CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::ET(fieldsets::ET::medium())), ) .unwrap(); let formatter_h24 = FixedCalendarDateTimeFormatter::try_new( &locale!("en-u-hc-h23").into(), - CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::ET(fieldset::ET::medium())), + CompositeDateTimeFieldSet::DateTime(DateAndTimeFieldSet::ET(fieldsets::ET::medium())), ) .unwrap(); diff --git a/components/icu/README.md b/components/icu/README.md index 8f2e20b1354..c0ff0a1f5cb 100644 --- a/components/icu/README.md +++ b/components/icu/README.md @@ -28,7 +28,7 @@ provide data explicitly using [`DataProvider`]s. Compiled data is exposed through idiomatic Rust constructors like `new` or `try_new`: ```rust -use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldset::YMD}; +use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldsets::YMD}; use icu::locale::locale; let dtf = DateTimeFormatter::try_new( @@ -51,7 +51,7 @@ Powerful data management is possible with [`DataProvider`]s, which are passed to special constructors: ```rust -use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldset::YMD}; +use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldsets::YMD}; use icu::locale::locale; use icu::locale::fallback::LocaleFallbacker; use icu_provider_adapters::fallback::LocaleFallbackProvider; diff --git a/components/icu/examples/tui.rs b/components/icu/examples/tui.rs index 8359d67139c..834d2cd1b4a 100644 --- a/components/icu/examples/tui.rs +++ b/components/icu/examples/tui.rs @@ -10,7 +10,7 @@ use icu::locale::locale; use icu::plurals::{PluralCategory, PluralRules}; use icu::timezone::TimeZoneInfo; use icu_collections::codepointinvlist::CodePointInversionListBuilder; -use icu_datetime::fieldset::YMDTO; +use icu_datetime::fieldsets::YMDTO; use icu_datetime::FixedCalendarDateTimeFormatter; use icu_timezone::CustomZonedDateTime; use std::env; diff --git a/components/icu/src/lib.rs b/components/icu/src/lib.rs index d3eb141adb4..147a62c861b 100644 --- a/components/icu/src/lib.rs +++ b/components/icu/src/lib.rs @@ -28,7 +28,7 @@ //! Compiled data is exposed through idiomatic Rust constructors like `new` or `try_new`: //! //! ``` -//! use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldset::YMD}; +//! use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldsets::YMD}; //! use icu::locale::locale; //! //! let dtf = DateTimeFormatter::try_new( @@ -51,7 +51,7 @@ //! special constructors: //! //! ```no_run -//! use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldset::YMD}; +//! use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldsets::YMD}; //! use icu::locale::locale; //! use icu::locale::fallback::LocaleFallbacker; //! use icu_provider_adapters::fallback::LocaleFallbackProvider; diff --git a/ffi/capi/src/datetime_formatter.rs b/ffi/capi/src/datetime_formatter.rs index c1b5501cd47..c7ce78d4669 100644 --- a/ffi/capi/src/datetime_formatter.rs +++ b/ffi/capi/src/datetime_formatter.rs @@ -8,7 +8,7 @@ pub mod ffi { use alloc::boxed::Box; use icu_datetime::{ - fieldset::{T, YMD, YMDT}, + fieldsets::{T, YMD, YMDT}, options::NeoSkeletonLength, }; diff --git a/ffi/capi/src/zoned_formatter.rs b/ffi/capi/src/zoned_formatter.rs index 5d681ea41bb..bdeaef1cea5 100644 --- a/ffi/capi/src/zoned_formatter.rs +++ b/ffi/capi/src/zoned_formatter.rs @@ -7,7 +7,7 @@ #[diplomat::attr(auto, namespace = "icu4x")] pub mod ffi { use alloc::boxed::Box; - use icu_datetime::{fieldset::YMDTV, options::NeoSkeletonLength}; + use icu_datetime::{fieldsets::YMDTV, options::NeoSkeletonLength}; use icu_timezone::ZoneVariant; use crate::{ diff --git a/ffi/capi/tests/missing_apis.txt b/ffi/capi/tests/missing_apis.txt index fc562f98406..8f9fa81c7bf 100644 --- a/ffi/capi/tests/missing_apis.txt +++ b/ffi/capi/tests/missing_apis.txt @@ -34,263 +34,255 @@ icu::datetime::MismatchedCalendarError#Struct icu::datetime::NeoSkeletonLength#Enum icu::datetime::NeoSkeletonLength::into_option#FnInEnum icu::datetime::TimeFormatter#Typedef -icu::datetime::fieldset::Combo#Struct -icu::datetime::fieldset::Combo::long#FnInStruct -icu::datetime::fieldset::Combo::medium#FnInStruct -icu::datetime::fieldset::Combo::short#FnInStruct -icu::datetime::fieldset::Combo::with_length#FnInStruct -icu::datetime::fieldset::D#Struct -icu::datetime::fieldset::D::long#FnInStruct -icu::datetime::fieldset::D::medium#FnInStruct -icu::datetime::fieldset::D::short#FnInStruct -icu::datetime::fieldset::D::with_alignment#FnInStruct -icu::datetime::fieldset::D::with_length#FnInStruct -icu::datetime::fieldset::D::zone_l#FnInStruct -icu::datetime::fieldset::D::zone_o#FnInStruct -icu::datetime::fieldset::D::zone_v#FnInStruct -icu::datetime::fieldset::D::zone_z#FnInStruct -icu::datetime::fieldset::DE#Struct -icu::datetime::fieldset::DE::long#FnInStruct -icu::datetime::fieldset::DE::medium#FnInStruct -icu::datetime::fieldset::DE::short#FnInStruct -icu::datetime::fieldset::DE::with_alignment#FnInStruct -icu::datetime::fieldset::DE::with_length#FnInStruct -icu::datetime::fieldset::DE::zone_l#FnInStruct -icu::datetime::fieldset::DE::zone_o#FnInStruct -icu::datetime::fieldset::DE::zone_v#FnInStruct -icu::datetime::fieldset::DE::zone_z#FnInStruct -icu::datetime::fieldset::DET#Struct -icu::datetime::fieldset::DET::hm#FnInStruct -icu::datetime::fieldset::DET::hms#FnInStruct -icu::datetime::fieldset::DET::long#FnInStruct -icu::datetime::fieldset::DET::medium#FnInStruct -icu::datetime::fieldset::DET::short#FnInStruct -icu::datetime::fieldset::DET::with_alignment#FnInStruct -icu::datetime::fieldset::DET::with_length#FnInStruct -icu::datetime::fieldset::DET::with_time_precision#FnInStruct -icu::datetime::fieldset::DET::zone_l#FnInStruct -icu::datetime::fieldset::DET::zone_o#FnInStruct -icu::datetime::fieldset::DET::zone_v#FnInStruct -icu::datetime::fieldset::DET::zone_z#FnInStruct -icu::datetime::fieldset::DT#Struct -icu::datetime::fieldset::DT::hm#FnInStruct -icu::datetime::fieldset::DT::hms#FnInStruct -icu::datetime::fieldset::DT::long#FnInStruct -icu::datetime::fieldset::DT::medium#FnInStruct -icu::datetime::fieldset::DT::short#FnInStruct -icu::datetime::fieldset::DT::with_alignment#FnInStruct -icu::datetime::fieldset::DT::with_length#FnInStruct -icu::datetime::fieldset::DT::with_time_precision#FnInStruct -icu::datetime::fieldset::DT::zone_l#FnInStruct -icu::datetime::fieldset::DT::zone_o#FnInStruct -icu::datetime::fieldset::DT::zone_v#FnInStruct -icu::datetime::fieldset::DT::zone_z#FnInStruct -icu::datetime::fieldset::E#Struct -icu::datetime::fieldset::E::long#FnInStruct -icu::datetime::fieldset::E::medium#FnInStruct -icu::datetime::fieldset::E::short#FnInStruct -icu::datetime::fieldset::E::with_length#FnInStruct -icu::datetime::fieldset::E::zone_l#FnInStruct -icu::datetime::fieldset::E::zone_o#FnInStruct -icu::datetime::fieldset::E::zone_v#FnInStruct -icu::datetime::fieldset::E::zone_z#FnInStruct -icu::datetime::fieldset::ET#Struct -icu::datetime::fieldset::ET::hm#FnInStruct -icu::datetime::fieldset::ET::hms#FnInStruct -icu::datetime::fieldset::ET::long#FnInStruct -icu::datetime::fieldset::ET::medium#FnInStruct -icu::datetime::fieldset::ET::short#FnInStruct -icu::datetime::fieldset::ET::with_alignment#FnInStruct -icu::datetime::fieldset::ET::with_length#FnInStruct -icu::datetime::fieldset::ET::with_time_precision#FnInStruct -icu::datetime::fieldset::ET::zone_l#FnInStruct -icu::datetime::fieldset::ET::zone_o#FnInStruct -icu::datetime::fieldset::ET::zone_v#FnInStruct -icu::datetime::fieldset::ET::zone_z#FnInStruct -icu::datetime::fieldset::L#Struct -icu::datetime::fieldset::L::long#FnInStruct -icu::datetime::fieldset::L::medium#FnInStruct -icu::datetime::fieldset::L::short#FnInStruct -icu::datetime::fieldset::L::with_length#FnInStruct -icu::datetime::fieldset::M#Struct -icu::datetime::fieldset::M::long#FnInStruct -icu::datetime::fieldset::M::medium#FnInStruct -icu::datetime::fieldset::M::short#FnInStruct -icu::datetime::fieldset::M::with_alignment#FnInStruct -icu::datetime::fieldset::M::with_length#FnInStruct -icu::datetime::fieldset::MD#Struct -icu::datetime::fieldset::MD::long#FnInStruct -icu::datetime::fieldset::MD::medium#FnInStruct -icu::datetime::fieldset::MD::short#FnInStruct -icu::datetime::fieldset::MD::with_alignment#FnInStruct -icu::datetime::fieldset::MD::with_length#FnInStruct -icu::datetime::fieldset::MD::zone_l#FnInStruct -icu::datetime::fieldset::MD::zone_o#FnInStruct -icu::datetime::fieldset::MD::zone_v#FnInStruct -icu::datetime::fieldset::MD::zone_z#FnInStruct -icu::datetime::fieldset::MDE#Struct -icu::datetime::fieldset::MDE::long#FnInStruct -icu::datetime::fieldset::MDE::medium#FnInStruct -icu::datetime::fieldset::MDE::short#FnInStruct -icu::datetime::fieldset::MDE::with_alignment#FnInStruct -icu::datetime::fieldset::MDE::with_length#FnInStruct -icu::datetime::fieldset::MDE::zone_l#FnInStruct -icu::datetime::fieldset::MDE::zone_o#FnInStruct -icu::datetime::fieldset::MDE::zone_v#FnInStruct -icu::datetime::fieldset::MDE::zone_z#FnInStruct -icu::datetime::fieldset::MDET#Struct -icu::datetime::fieldset::MDET::hm#FnInStruct -icu::datetime::fieldset::MDET::hms#FnInStruct -icu::datetime::fieldset::MDET::long#FnInStruct -icu::datetime::fieldset::MDET::medium#FnInStruct -icu::datetime::fieldset::MDET::short#FnInStruct -icu::datetime::fieldset::MDET::with_alignment#FnInStruct -icu::datetime::fieldset::MDET::with_length#FnInStruct -icu::datetime::fieldset::MDET::with_time_precision#FnInStruct -icu::datetime::fieldset::MDET::zone_l#FnInStruct -icu::datetime::fieldset::MDET::zone_o#FnInStruct -icu::datetime::fieldset::MDET::zone_v#FnInStruct -icu::datetime::fieldset::MDET::zone_z#FnInStruct -icu::datetime::fieldset::MDT#Struct -icu::datetime::fieldset::MDT::hm#FnInStruct -icu::datetime::fieldset::MDT::hms#FnInStruct -icu::datetime::fieldset::MDT::long#FnInStruct -icu::datetime::fieldset::MDT::medium#FnInStruct -icu::datetime::fieldset::MDT::short#FnInStruct -icu::datetime::fieldset::MDT::with_alignment#FnInStruct -icu::datetime::fieldset::MDT::with_length#FnInStruct -icu::datetime::fieldset::MDT::with_time_precision#FnInStruct -icu::datetime::fieldset::MDT::zone_l#FnInStruct -icu::datetime::fieldset::MDT::zone_o#FnInStruct -icu::datetime::fieldset::MDT::zone_v#FnInStruct -icu::datetime::fieldset::MDT::zone_z#FnInStruct -icu::datetime::fieldset::O#Struct -icu::datetime::fieldset::O::long#FnInStruct -icu::datetime::fieldset::O::medium#FnInStruct -icu::datetime::fieldset::O::short#FnInStruct -icu::datetime::fieldset::O::with_length#FnInStruct -icu::datetime::fieldset::T#Struct -icu::datetime::fieldset::T::hm#FnInStruct -icu::datetime::fieldset::T::hms#FnInStruct -icu::datetime::fieldset::T::long#FnInStruct -icu::datetime::fieldset::T::medium#FnInStruct -icu::datetime::fieldset::T::short#FnInStruct -icu::datetime::fieldset::T::with_alignment#FnInStruct -icu::datetime::fieldset::T::with_length#FnInStruct -icu::datetime::fieldset::T::with_time_precision#FnInStruct -icu::datetime::fieldset::T::zone_l#FnInStruct -icu::datetime::fieldset::T::zone_o#FnInStruct -icu::datetime::fieldset::T::zone_v#FnInStruct -icu::datetime::fieldset::T::zone_z#FnInStruct -icu::datetime::fieldset::V#Struct -icu::datetime::fieldset::V::long#FnInStruct -icu::datetime::fieldset::V::medium#FnInStruct -icu::datetime::fieldset::V::short#FnInStruct -icu::datetime::fieldset::V::with_length#FnInStruct -icu::datetime::fieldset::Vs#Struct -icu::datetime::fieldset::Vs::long#FnInStruct -icu::datetime::fieldset::Vs::medium#FnInStruct -icu::datetime::fieldset::Vs::short#FnInStruct -icu::datetime::fieldset::Vs::with_length#FnInStruct -icu::datetime::fieldset::Y#Struct -icu::datetime::fieldset::Y::long#FnInStruct -icu::datetime::fieldset::Y::medium#FnInStruct -icu::datetime::fieldset::Y::short#FnInStruct -icu::datetime::fieldset::Y::with_alignment#FnInStruct -icu::datetime::fieldset::Y::with_length#FnInStruct -icu::datetime::fieldset::Y::with_year_style#FnInStruct -icu::datetime::fieldset::YM#Struct -icu::datetime::fieldset::YM::long#FnInStruct -icu::datetime::fieldset::YM::medium#FnInStruct -icu::datetime::fieldset::YM::short#FnInStruct -icu::datetime::fieldset::YM::with_alignment#FnInStruct -icu::datetime::fieldset::YM::with_length#FnInStruct -icu::datetime::fieldset::YM::with_year_style#FnInStruct -icu::datetime::fieldset::YMD#Struct -icu::datetime::fieldset::YMD::long#FnInStruct -icu::datetime::fieldset::YMD::medium#FnInStruct -icu::datetime::fieldset::YMD::short#FnInStruct -icu::datetime::fieldset::YMD::with_alignment#FnInStruct -icu::datetime::fieldset::YMD::with_length#FnInStruct -icu::datetime::fieldset::YMD::with_year_style#FnInStruct -icu::datetime::fieldset::YMD::zone_l#FnInStruct -icu::datetime::fieldset::YMD::zone_o#FnInStruct -icu::datetime::fieldset::YMD::zone_v#FnInStruct -icu::datetime::fieldset::YMD::zone_z#FnInStruct -icu::datetime::fieldset::YMDE#Struct -icu::datetime::fieldset::YMDE::long#FnInStruct -icu::datetime::fieldset::YMDE::medium#FnInStruct -icu::datetime::fieldset::YMDE::short#FnInStruct -icu::datetime::fieldset::YMDE::with_alignment#FnInStruct -icu::datetime::fieldset::YMDE::with_length#FnInStruct -icu::datetime::fieldset::YMDE::with_year_style#FnInStruct -icu::datetime::fieldset::YMDE::zone_l#FnInStruct -icu::datetime::fieldset::YMDE::zone_o#FnInStruct -icu::datetime::fieldset::YMDE::zone_v#FnInStruct -icu::datetime::fieldset::YMDE::zone_z#FnInStruct -icu::datetime::fieldset::YMDET#Struct -icu::datetime::fieldset::YMDET::hm#FnInStruct -icu::datetime::fieldset::YMDET::hms#FnInStruct -icu::datetime::fieldset::YMDET::long#FnInStruct -icu::datetime::fieldset::YMDET::medium#FnInStruct -icu::datetime::fieldset::YMDET::short#FnInStruct -icu::datetime::fieldset::YMDET::with_alignment#FnInStruct -icu::datetime::fieldset::YMDET::with_length#FnInStruct -icu::datetime::fieldset::YMDET::with_time_precision#FnInStruct -icu::datetime::fieldset::YMDET::with_year_style#FnInStruct -icu::datetime::fieldset::YMDET::zone_l#FnInStruct -icu::datetime::fieldset::YMDET::zone_o#FnInStruct -icu::datetime::fieldset::YMDET::zone_v#FnInStruct -icu::datetime::fieldset::YMDET::zone_z#FnInStruct -icu::datetime::fieldset::YMDT#Struct -icu::datetime::fieldset::YMDT::hm#FnInStruct -icu::datetime::fieldset::YMDT::hms#FnInStruct -icu::datetime::fieldset::YMDT::long#FnInStruct -icu::datetime::fieldset::YMDT::medium#FnInStruct -icu::datetime::fieldset::YMDT::short#FnInStruct -icu::datetime::fieldset::YMDT::with_alignment#FnInStruct -icu::datetime::fieldset::YMDT::with_length#FnInStruct -icu::datetime::fieldset::YMDT::with_time_precision#FnInStruct -icu::datetime::fieldset::YMDT::with_year_style#FnInStruct -icu::datetime::fieldset::YMDT::zone_l#FnInStruct -icu::datetime::fieldset::YMDT::zone_o#FnInStruct -icu::datetime::fieldset::YMDT::zone_v#FnInStruct -icu::datetime::fieldset::YMDT::zone_z#FnInStruct -icu::datetime::fieldset::YMDTO#Typedef -icu::datetime::fieldset::YMDTV#Typedef -icu::datetime::fieldset::YMDTZ#Typedef -icu::datetime::fieldset::Z#Struct -icu::datetime::fieldset::Z::long#FnInStruct -icu::datetime::fieldset::Z::medium#FnInStruct -icu::datetime::fieldset::Z::short#FnInStruct -icu::datetime::fieldset::Z::with_length#FnInStruct -icu::datetime::fieldset::Zs#Struct -icu::datetime::fieldset::Zs::long#FnInStruct -icu::datetime::fieldset::Zs::medium#FnInStruct -icu::datetime::fieldset::Zs::short#FnInStruct -icu::datetime::fieldset::Zs::with_length#FnInStruct -icu::datetime::fieldset::dynamic::CalendarPeriodFieldSet#Enum -icu::datetime::fieldset::dynamic::CompositeDateTimeFieldSet#Enum -icu::datetime::fieldset::dynamic::CompositeDateTimeFieldSet::to_composite_field_set#FnInEnum -icu::datetime::fieldset::dynamic::CompositeDateTimeFieldSet::try_from_composite_field_set#FnInEnum -icu::datetime::fieldset::dynamic::CompositeFieldSet#Enum -icu::datetime::fieldset::dynamic::DateAndTimeFieldSet#Enum -icu::datetime::fieldset::dynamic::DateAndTimeFieldSet::zone_l#FnInEnum -icu::datetime::fieldset::dynamic::DateAndTimeFieldSet::zone_o#FnInEnum -icu::datetime::fieldset::dynamic::DateAndTimeFieldSet::zone_v#FnInEnum -icu::datetime::fieldset::dynamic::DateAndTimeFieldSet::zone_z#FnInEnum -icu::datetime::fieldset::dynamic::DateFieldSet#Enum -icu::datetime::fieldset::dynamic::DateFieldSet::zone_l#FnInEnum -icu::datetime::fieldset::dynamic::DateFieldSet::zone_o#FnInEnum -icu::datetime::fieldset::dynamic::DateFieldSet::zone_v#FnInEnum -icu::datetime::fieldset::dynamic::DateFieldSet::zone_z#FnInEnum -icu::datetime::fieldset::dynamic::TimeFieldSet#Enum -icu::datetime::fieldset::dynamic::TimeFieldSet::zone_l#FnInEnum -icu::datetime::fieldset::dynamic::TimeFieldSet::zone_o#FnInEnum -icu::datetime::fieldset::dynamic::TimeFieldSet::zone_v#FnInEnum -icu::datetime::fieldset::dynamic::TimeFieldSet::zone_z#FnInEnum -icu::datetime::fieldset::dynamic::ZoneFieldSet#Enum -icu::datetime::fieldset::dynamic::ZoneStyle#Enum +icu::datetime::fieldsets::Combo#Struct +icu::datetime::fieldsets::Combo::long#FnInStruct +icu::datetime::fieldsets::Combo::medium#FnInStruct +icu::datetime::fieldsets::Combo::short#FnInStruct +icu::datetime::fieldsets::Combo::with_length#FnInStruct +icu::datetime::fieldsets::D#Struct +icu::datetime::fieldsets::D::long#FnInStruct +icu::datetime::fieldsets::D::medium#FnInStruct +icu::datetime::fieldsets::D::short#FnInStruct +icu::datetime::fieldsets::D::with_alignment#FnInStruct +icu::datetime::fieldsets::D::with_length#FnInStruct +icu::datetime::fieldsets::D::zone_l#FnInStruct +icu::datetime::fieldsets::D::zone_o#FnInStruct +icu::datetime::fieldsets::D::zone_v#FnInStruct +icu::datetime::fieldsets::D::zone_z#FnInStruct +icu::datetime::fieldsets::DE#Struct +icu::datetime::fieldsets::DE::long#FnInStruct +icu::datetime::fieldsets::DE::medium#FnInStruct +icu::datetime::fieldsets::DE::short#FnInStruct +icu::datetime::fieldsets::DE::with_alignment#FnInStruct +icu::datetime::fieldsets::DE::with_length#FnInStruct +icu::datetime::fieldsets::DE::zone_l#FnInStruct +icu::datetime::fieldsets::DE::zone_o#FnInStruct +icu::datetime::fieldsets::DE::zone_v#FnInStruct +icu::datetime::fieldsets::DE::zone_z#FnInStruct +icu::datetime::fieldsets::DET#Struct +icu::datetime::fieldsets::DET::hm#FnInStruct +icu::datetime::fieldsets::DET::long#FnInStruct +icu::datetime::fieldsets::DET::medium#FnInStruct +icu::datetime::fieldsets::DET::short#FnInStruct +icu::datetime::fieldsets::DET::with_alignment#FnInStruct +icu::datetime::fieldsets::DET::with_length#FnInStruct +icu::datetime::fieldsets::DET::with_time_precision#FnInStruct +icu::datetime::fieldsets::DET::zone_l#FnInStruct +icu::datetime::fieldsets::DET::zone_o#FnInStruct +icu::datetime::fieldsets::DET::zone_v#FnInStruct +icu::datetime::fieldsets::DET::zone_z#FnInStruct +icu::datetime::fieldsets::DT#Struct +icu::datetime::fieldsets::DT::hm#FnInStruct +icu::datetime::fieldsets::DT::long#FnInStruct +icu::datetime::fieldsets::DT::medium#FnInStruct +icu::datetime::fieldsets::DT::short#FnInStruct +icu::datetime::fieldsets::DT::with_alignment#FnInStruct +icu::datetime::fieldsets::DT::with_length#FnInStruct +icu::datetime::fieldsets::DT::with_time_precision#FnInStruct +icu::datetime::fieldsets::DT::zone_l#FnInStruct +icu::datetime::fieldsets::DT::zone_o#FnInStruct +icu::datetime::fieldsets::DT::zone_v#FnInStruct +icu::datetime::fieldsets::DT::zone_z#FnInStruct +icu::datetime::fieldsets::E#Struct +icu::datetime::fieldsets::E::long#FnInStruct +icu::datetime::fieldsets::E::medium#FnInStruct +icu::datetime::fieldsets::E::short#FnInStruct +icu::datetime::fieldsets::E::with_length#FnInStruct +icu::datetime::fieldsets::E::zone_l#FnInStruct +icu::datetime::fieldsets::E::zone_o#FnInStruct +icu::datetime::fieldsets::E::zone_v#FnInStruct +icu::datetime::fieldsets::E::zone_z#FnInStruct +icu::datetime::fieldsets::ET#Struct +icu::datetime::fieldsets::ET::hm#FnInStruct +icu::datetime::fieldsets::ET::long#FnInStruct +icu::datetime::fieldsets::ET::medium#FnInStruct +icu::datetime::fieldsets::ET::short#FnInStruct +icu::datetime::fieldsets::ET::with_alignment#FnInStruct +icu::datetime::fieldsets::ET::with_length#FnInStruct +icu::datetime::fieldsets::ET::with_time_precision#FnInStruct +icu::datetime::fieldsets::ET::zone_l#FnInStruct +icu::datetime::fieldsets::ET::zone_o#FnInStruct +icu::datetime::fieldsets::ET::zone_v#FnInStruct +icu::datetime::fieldsets::ET::zone_z#FnInStruct +icu::datetime::fieldsets::L#Struct +icu::datetime::fieldsets::L::long#FnInStruct +icu::datetime::fieldsets::L::medium#FnInStruct +icu::datetime::fieldsets::L::short#FnInStruct +icu::datetime::fieldsets::L::with_length#FnInStruct +icu::datetime::fieldsets::M#Struct +icu::datetime::fieldsets::M::long#FnInStruct +icu::datetime::fieldsets::M::medium#FnInStruct +icu::datetime::fieldsets::M::short#FnInStruct +icu::datetime::fieldsets::M::with_alignment#FnInStruct +icu::datetime::fieldsets::M::with_length#FnInStruct +icu::datetime::fieldsets::MD#Struct +icu::datetime::fieldsets::MD::long#FnInStruct +icu::datetime::fieldsets::MD::medium#FnInStruct +icu::datetime::fieldsets::MD::short#FnInStruct +icu::datetime::fieldsets::MD::with_alignment#FnInStruct +icu::datetime::fieldsets::MD::with_length#FnInStruct +icu::datetime::fieldsets::MD::zone_l#FnInStruct +icu::datetime::fieldsets::MD::zone_o#FnInStruct +icu::datetime::fieldsets::MD::zone_v#FnInStruct +icu::datetime::fieldsets::MD::zone_z#FnInStruct +icu::datetime::fieldsets::MDE#Struct +icu::datetime::fieldsets::MDE::long#FnInStruct +icu::datetime::fieldsets::MDE::medium#FnInStruct +icu::datetime::fieldsets::MDE::short#FnInStruct +icu::datetime::fieldsets::MDE::with_alignment#FnInStruct +icu::datetime::fieldsets::MDE::with_length#FnInStruct +icu::datetime::fieldsets::MDE::zone_l#FnInStruct +icu::datetime::fieldsets::MDE::zone_o#FnInStruct +icu::datetime::fieldsets::MDE::zone_v#FnInStruct +icu::datetime::fieldsets::MDE::zone_z#FnInStruct +icu::datetime::fieldsets::MDET#Struct +icu::datetime::fieldsets::MDET::hm#FnInStruct +icu::datetime::fieldsets::MDET::long#FnInStruct +icu::datetime::fieldsets::MDET::medium#FnInStruct +icu::datetime::fieldsets::MDET::short#FnInStruct +icu::datetime::fieldsets::MDET::with_alignment#FnInStruct +icu::datetime::fieldsets::MDET::with_length#FnInStruct +icu::datetime::fieldsets::MDET::with_time_precision#FnInStruct +icu::datetime::fieldsets::MDET::zone_l#FnInStruct +icu::datetime::fieldsets::MDET::zone_o#FnInStruct +icu::datetime::fieldsets::MDET::zone_v#FnInStruct +icu::datetime::fieldsets::MDET::zone_z#FnInStruct +icu::datetime::fieldsets::MDT#Struct +icu::datetime::fieldsets::MDT::hm#FnInStruct +icu::datetime::fieldsets::MDT::long#FnInStruct +icu::datetime::fieldsets::MDT::medium#FnInStruct +icu::datetime::fieldsets::MDT::short#FnInStruct +icu::datetime::fieldsets::MDT::with_alignment#FnInStruct +icu::datetime::fieldsets::MDT::with_length#FnInStruct +icu::datetime::fieldsets::MDT::with_time_precision#FnInStruct +icu::datetime::fieldsets::MDT::zone_l#FnInStruct +icu::datetime::fieldsets::MDT::zone_o#FnInStruct +icu::datetime::fieldsets::MDT::zone_v#FnInStruct +icu::datetime::fieldsets::MDT::zone_z#FnInStruct +icu::datetime::fieldsets::O#Struct +icu::datetime::fieldsets::O::long#FnInStruct +icu::datetime::fieldsets::O::medium#FnInStruct +icu::datetime::fieldsets::O::short#FnInStruct +icu::datetime::fieldsets::O::with_length#FnInStruct +icu::datetime::fieldsets::T#Struct +icu::datetime::fieldsets::T::hm#FnInStruct +icu::datetime::fieldsets::T::long#FnInStruct +icu::datetime::fieldsets::T::medium#FnInStruct +icu::datetime::fieldsets::T::short#FnInStruct +icu::datetime::fieldsets::T::with_alignment#FnInStruct +icu::datetime::fieldsets::T::with_length#FnInStruct +icu::datetime::fieldsets::T::with_time_precision#FnInStruct +icu::datetime::fieldsets::T::zone_l#FnInStruct +icu::datetime::fieldsets::T::zone_o#FnInStruct +icu::datetime::fieldsets::T::zone_v#FnInStruct +icu::datetime::fieldsets::T::zone_z#FnInStruct +icu::datetime::fieldsets::V#Struct +icu::datetime::fieldsets::V::long#FnInStruct +icu::datetime::fieldsets::V::medium#FnInStruct +icu::datetime::fieldsets::V::short#FnInStruct +icu::datetime::fieldsets::V::with_length#FnInStruct +icu::datetime::fieldsets::Vs#Struct +icu::datetime::fieldsets::Vs::long#FnInStruct +icu::datetime::fieldsets::Vs::medium#FnInStruct +icu::datetime::fieldsets::Vs::short#FnInStruct +icu::datetime::fieldsets::Vs::with_length#FnInStruct +icu::datetime::fieldsets::Y#Struct +icu::datetime::fieldsets::Y::long#FnInStruct +icu::datetime::fieldsets::Y::medium#FnInStruct +icu::datetime::fieldsets::Y::short#FnInStruct +icu::datetime::fieldsets::Y::with_alignment#FnInStruct +icu::datetime::fieldsets::Y::with_length#FnInStruct +icu::datetime::fieldsets::Y::with_year_style#FnInStruct +icu::datetime::fieldsets::YM#Struct +icu::datetime::fieldsets::YM::long#FnInStruct +icu::datetime::fieldsets::YM::medium#FnInStruct +icu::datetime::fieldsets::YM::short#FnInStruct +icu::datetime::fieldsets::YM::with_alignment#FnInStruct +icu::datetime::fieldsets::YM::with_length#FnInStruct +icu::datetime::fieldsets::YM::with_year_style#FnInStruct +icu::datetime::fieldsets::YMD#Struct +icu::datetime::fieldsets::YMD::long#FnInStruct +icu::datetime::fieldsets::YMD::medium#FnInStruct +icu::datetime::fieldsets::YMD::short#FnInStruct +icu::datetime::fieldsets::YMD::with_alignment#FnInStruct +icu::datetime::fieldsets::YMD::with_length#FnInStruct +icu::datetime::fieldsets::YMD::with_year_style#FnInStruct +icu::datetime::fieldsets::YMD::zone_l#FnInStruct +icu::datetime::fieldsets::YMD::zone_o#FnInStruct +icu::datetime::fieldsets::YMD::zone_v#FnInStruct +icu::datetime::fieldsets::YMD::zone_z#FnInStruct +icu::datetime::fieldsets::YMDE#Struct +icu::datetime::fieldsets::YMDE::long#FnInStruct +icu::datetime::fieldsets::YMDE::medium#FnInStruct +icu::datetime::fieldsets::YMDE::short#FnInStruct +icu::datetime::fieldsets::YMDE::with_alignment#FnInStruct +icu::datetime::fieldsets::YMDE::with_length#FnInStruct +icu::datetime::fieldsets::YMDE::with_year_style#FnInStruct +icu::datetime::fieldsets::YMDE::zone_l#FnInStruct +icu::datetime::fieldsets::YMDE::zone_o#FnInStruct +icu::datetime::fieldsets::YMDE::zone_v#FnInStruct +icu::datetime::fieldsets::YMDE::zone_z#FnInStruct +icu::datetime::fieldsets::YMDET#Struct +icu::datetime::fieldsets::YMDET::hm#FnInStruct +icu::datetime::fieldsets::YMDET::long#FnInStruct +icu::datetime::fieldsets::YMDET::medium#FnInStruct +icu::datetime::fieldsets::YMDET::short#FnInStruct +icu::datetime::fieldsets::YMDET::with_alignment#FnInStruct +icu::datetime::fieldsets::YMDET::with_length#FnInStruct +icu::datetime::fieldsets::YMDET::with_time_precision#FnInStruct +icu::datetime::fieldsets::YMDET::with_year_style#FnInStruct +icu::datetime::fieldsets::YMDET::zone_l#FnInStruct +icu::datetime::fieldsets::YMDET::zone_o#FnInStruct +icu::datetime::fieldsets::YMDET::zone_v#FnInStruct +icu::datetime::fieldsets::YMDET::zone_z#FnInStruct +icu::datetime::fieldsets::YMDT#Struct +icu::datetime::fieldsets::YMDT::hm#FnInStruct +icu::datetime::fieldsets::YMDT::long#FnInStruct +icu::datetime::fieldsets::YMDT::medium#FnInStruct +icu::datetime::fieldsets::YMDT::short#FnInStruct +icu::datetime::fieldsets::YMDT::with_alignment#FnInStruct +icu::datetime::fieldsets::YMDT::with_length#FnInStruct +icu::datetime::fieldsets::YMDT::with_time_precision#FnInStruct +icu::datetime::fieldsets::YMDT::with_year_style#FnInStruct +icu::datetime::fieldsets::YMDT::zone_l#FnInStruct +icu::datetime::fieldsets::YMDT::zone_o#FnInStruct +icu::datetime::fieldsets::YMDT::zone_v#FnInStruct +icu::datetime::fieldsets::YMDT::zone_z#FnInStruct +icu::datetime::fieldsets::YMDTO#Typedef +icu::datetime::fieldsets::YMDTV#Typedef +icu::datetime::fieldsets::YMDTZ#Typedef +icu::datetime::fieldsets::Z#Struct +icu::datetime::fieldsets::Z::long#FnInStruct +icu::datetime::fieldsets::Z::medium#FnInStruct +icu::datetime::fieldsets::Z::short#FnInStruct +icu::datetime::fieldsets::Z::with_length#FnInStruct +icu::datetime::fieldsets::Zs#Struct +icu::datetime::fieldsets::Zs::long#FnInStruct +icu::datetime::fieldsets::Zs::medium#FnInStruct +icu::datetime::fieldsets::Zs::short#FnInStruct +icu::datetime::fieldsets::Zs::with_length#FnInStruct +icu::datetime::fieldsets::enums::CalendarPeriodFieldSet#Enum +icu::datetime::fieldsets::enums::CompositeDateTimeFieldSet#Enum +icu::datetime::fieldsets::enums::CompositeDateTimeFieldSet::to_composite_field_set#FnInEnum +icu::datetime::fieldsets::enums::CompositeDateTimeFieldSet::try_from_composite_field_set#FnInEnum +icu::datetime::fieldsets::enums::CompositeFieldSet#Enum +icu::datetime::fieldsets::enums::DateAndTimeFieldSet#Enum +icu::datetime::fieldsets::enums::DateAndTimeFieldSet::zone_l#FnInEnum +icu::datetime::fieldsets::enums::DateAndTimeFieldSet::zone_o#FnInEnum +icu::datetime::fieldsets::enums::DateAndTimeFieldSet::zone_v#FnInEnum +icu::datetime::fieldsets::enums::DateAndTimeFieldSet::zone_z#FnInEnum +icu::datetime::fieldsets::enums::DateFieldSet#Enum +icu::datetime::fieldsets::enums::DateFieldSet::zone_l#FnInEnum +icu::datetime::fieldsets::enums::DateFieldSet::zone_o#FnInEnum +icu::datetime::fieldsets::enums::DateFieldSet::zone_v#FnInEnum +icu::datetime::fieldsets::enums::DateFieldSet::zone_z#FnInEnum +icu::datetime::fieldsets::enums::TimeFieldSet#Enum +icu::datetime::fieldsets::enums::TimeFieldSet::zone_l#FnInEnum +icu::datetime::fieldsets::enums::TimeFieldSet::zone_o#FnInEnum +icu::datetime::fieldsets::enums::TimeFieldSet::zone_v#FnInEnum +icu::datetime::fieldsets::enums::TimeFieldSet::zone_z#FnInEnum +icu::datetime::fieldsets::enums::ZoneFieldSet#Enum +icu::datetime::fieldsets::enums::ZoneStyle#Enum icu::datetime::options::Alignment#Enum icu::datetime::options::Alignment::into_option#FnInEnum icu::datetime::options::FractionalSecondDigits#Enum diff --git a/provider/source/src/datetime/neo_skeleton.rs b/provider/source/src/datetime/neo_skeleton.rs index 9f76c41fd79..8c2264ae8d1 100644 --- a/provider/source/src/datetime/neo_skeleton.rs +++ b/provider/source/src/datetime/neo_skeleton.rs @@ -7,7 +7,7 @@ use std::collections::HashSet; use crate::{IterableDataProviderCached, SourceDataProvider}; use either::Either; use icu::datetime::fields::components; -use icu::datetime::fieldset::dynamic::*; +use icu::datetime::fieldsets::enums::*; use icu::datetime::options::NeoSkeletonLength; use icu::datetime::provider::calendar::{DateLengthsV1, DateSkeletonPatternsV1, TimeLengthsV1}; use icu::datetime::provider::pattern::runtime; diff --git a/tools/make/diplomat-coverage/src/allowlist.rs b/tools/make/diplomat-coverage/src/allowlist.rs index 37062c6a4d1..f7b7f9aa735 100644 --- a/tools/make/diplomat-coverage/src/allowlist.rs +++ b/tools/make/diplomat-coverage/src/allowlist.rs @@ -189,7 +189,7 @@ lazy_static::lazy_static! { // experimental "icu::datetime::fields::components", - "icu::datetime::fieldset::serde", + "icu::datetime::fieldsets::serde", "icu::datetime::neo_pattern", "icu::datetime::neo_skeleton", "icu::datetime::options::components", diff --git a/tutorials/data_management.md b/tutorials/data_management.md index 5f62f71e975..fdee122a3a2 100644 --- a/tutorials/data_management.md +++ b/tutorials/data_management.md @@ -154,7 +154,7 @@ We can then use the provider in our code: ```rust,no_run use icu::locale::{locale, Locale, fallback::LocaleFallbacker}; use icu::calendar::DateTime; -use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldset::YMDT}; +use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldsets::YMDT}; use icu_provider_adapters::fallback::LocaleFallbackProvider; use icu_provider_blob::BlobDataProvider; @@ -207,7 +207,7 @@ We can instead use `FixedCalendarDateTimeFormatter`, which only suppo ```rust,no_run use icu::locale::{locale, Locale, fallback::LocaleFallbacker}; use icu::calendar::{DateTime, Gregorian}; -use icu::datetime::{FixedCalendarDateTimeFormatter, fieldset::YMDT, NeoSkeletonLength}; +use icu::datetime::{FixedCalendarDateTimeFormatter, fieldsets::YMDT, NeoSkeletonLength}; use icu_provider_adapters::fallback::LocaleFallbackProvider; use icu_provider_blob::BlobDataProvider; diff --git a/tutorials/intro.md b/tutorials/intro.md index 99bc52e16b8..2dab5163b14 100644 --- a/tutorials/intro.md +++ b/tutorials/intro.md @@ -107,7 +107,7 @@ which is exposed through constructors such as `try_new`. ```rust use icu::locale::{Locale, locale}; use icu::calendar::DateTime; -use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldset::YMDT}; +use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldsets::YMDT}; const LOCALE: Locale = locale!("ja"); // let's try some other language diff --git a/tutorials/intro_interactive.md b/tutorials/intro_interactive.md index 509d75a1206..51440588a8a 100644 --- a/tutorials/intro_interactive.md +++ b/tutorials/intro_interactive.md @@ -144,7 +144,7 @@ Now we can write the Rust code: ```rust // At the top of the file: use icu::calendar::{Date, Iso}; -use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldset::YMD}; +use icu::datetime::{DateTimeFormatter, NeoSkeletonLength, fieldsets::YMD}; let locale = icu::locale::Locale::default(); // to make this example compile diff --git a/tutorials/rust/buffer/src/main.rs b/tutorials/rust/buffer/src/main.rs index 3642ad54561..71c6e32c86e 100644 --- a/tutorials/rust/buffer/src/main.rs +++ b/tutorials/rust/buffer/src/main.rs @@ -14,7 +14,7 @@ //! For more information, see the tutorial [cargo.md](../../cargo.md). use icu::calendar::{DateTime, Gregorian}; -use icu::datetime::{FixedCalendarDateTimeFormatter, fieldset::YMDT, options::NeoSkeletonLength}; +use icu::datetime::{FixedCalendarDateTimeFormatter, fieldsets::YMDT, options::NeoSkeletonLength}; use icu::locale::locale; use icu_provider_blob::BlobDataProvider;