From cd5dff77a86638922215ff67dc3aced1d5856545 Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Fri, 18 Oct 2024 12:09:15 -0700 Subject: [PATCH] Fixes --- components/datetime/benches/datetime.rs | 2 +- components/datetime/src/lib.rs | 1 + components/datetime/src/neo_pattern.rs | 2 +- components/icu/examples/tui.rs | 2 +- ffi/capi/src/datetime_formatter.rs | 40 ++++++++++++------------- ffi/capi/src/zoned_formatter.rs | 16 +++++----- 6 files changed, 32 insertions(+), 31 deletions(-) diff --git a/components/datetime/benches/datetime.rs b/components/datetime/benches/datetime.rs index 5b454d3e85..f253847da0 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::neo::FixedCalendarDateTimeFormatter; +use icu_datetime::FixedCalendarDateTimeFormatter; use icu_calendar::{Date, DateTime, Gregorian, Time}; use icu_locale_core::Locale; diff --git a/components/datetime/src/lib.rs b/components/datetime/src/lib.rs index ad569bdc7a..65a35589aa 100644 --- a/components/datetime/src/lib.rs +++ b/components/datetime/src/lib.rs @@ -121,4 +121,5 @@ pub use format::neo::{FormattedDateTimePattern, LoadError, SingleLoadError, Type pub use neo::DateTimeFormatter; pub use neo::FixedCalendarDateTimeFormatter; +pub use neo::FormattedNeoDateTime; pub use neo_skeleton::NeoSkeletonLength; diff --git a/components/datetime/src/neo_pattern.rs b/components/datetime/src/neo_pattern.rs index e599cecfdb..9f7df7dd27 100644 --- a/components/datetime/src/neo_pattern.rs +++ b/components/datetime/src/neo_pattern.rs @@ -76,7 +76,7 @@ size_test!(DateTimePattern, date_time_pattern_size, 32); /// ``` /// /// [`DateTimeFormatter`]: crate::DateTimeFormatter -/// [`FormattedNeoDateTime::pattern`]: crate::neo::FormattedNeoDateTime::pattern +/// [`FormattedNeoDateTime::pattern`]: crate::FormattedNeoDateTime::pattern /// [`TypedDateTimeNames`]: crate::TypedDateTimeNames #[derive(Debug)] pub struct DateTimePattern { diff --git a/components/icu/examples/tui.rs b/components/icu/examples/tui.rs index 8aa367acc4..fba25a9e46 100644 --- a/components/icu/examples/tui.rs +++ b/components/icu/examples/tui.rs @@ -10,9 +10,9 @@ use icu::locale::locale; use icu::plurals::{PluralCategory, PluralRules}; use icu::timezone::TimeZoneInfo; use icu_collections::codepointinvlist::CodePointInversionListBuilder; -use icu_datetime::neo::FixedCalendarDateTimeFormatter; use icu_datetime::neo_marker::NeoYearMonthDayHourMinuteSecondTimeZoneOffsetMarker; use icu_datetime::neo_skeleton::NeoSkeletonLength; +use icu_datetime::FixedCalendarDateTimeFormatter; use icu_timezone::CustomZonedDateTime; use std::env; use writeable::adapters::LossyWrap; diff --git a/ffi/capi/src/datetime_formatter.rs b/ffi/capi/src/datetime_formatter.rs index 298405b915..8bbd53e1b7 100644 --- a/ffi/capi/src/datetime_formatter.rs +++ b/ffi/capi/src/datetime_formatter.rs @@ -27,7 +27,7 @@ pub mod ffi { /// An ICU4X TimeFormatter object capable of formatting an [`Time`] type (and others) as a string #[diplomat::rust_link(icu::datetime, Mod)] pub struct TimeFormatter( - pub icu_datetime::neo::FixedCalendarDateTimeFormatter<(), NeoHourMinuteMarker>, + pub icu_datetime::FixedCalendarDateTimeFormatter<(), NeoHourMinuteMarker>, ); #[diplomat::enum_convert(icu_datetime::neo_skeleton::NeoSkeletonLength, needs_wildcard)] @@ -51,9 +51,9 @@ pub mod ffi { let options = NeoHourMinuteMarker::with_length(NeoSkeletonLength::from(length)); Ok(Box::new(TimeFormatter(call_constructor!( - icu_datetime::neo::FixedCalendarDateTimeFormatter::try_new, - icu_datetime::neo::FixedCalendarDateTimeFormatter::try_new_with_any_provider, - icu_datetime::neo::FixedCalendarDateTimeFormatter::try_new_with_buffer_provider, + icu_datetime::FixedCalendarDateTimeFormatter::try_new, + icu_datetime::FixedCalendarDateTimeFormatter::try_new_with_any_provider, + icu_datetime::FixedCalendarDateTimeFormatter::try_new_with_buffer_provider, provider, &locale, options @@ -89,7 +89,7 @@ pub mod ffi { /// using the Gregorian Calendar. #[diplomat::rust_link(icu::datetime, Mod)] pub struct GregorianDateFormatter( - pub icu_datetime::neo::FixedCalendarDateTimeFormatter< + pub icu_datetime::FixedCalendarDateTimeFormatter< icu_calendar::Gregorian, NeoYearMonthDayMarker, >, @@ -108,9 +108,9 @@ pub mod ffi { let options = NeoYearMonthDayMarker::with_length(NeoSkeletonLength::from(length)); Ok(Box::new(GregorianDateFormatter(call_constructor!( - icu_datetime::neo::FixedCalendarDateTimeFormatter::try_new, - icu_datetime::neo::FixedCalendarDateTimeFormatter::try_new_with_any_provider, - icu_datetime::neo::FixedCalendarDateTimeFormatter::try_new_with_buffer_provider, + icu_datetime::FixedCalendarDateTimeFormatter::try_new, + icu_datetime::FixedCalendarDateTimeFormatter::try_new_with_any_provider, + icu_datetime::FixedCalendarDateTimeFormatter::try_new_with_buffer_provider, provider, &locale, options @@ -142,7 +142,7 @@ pub mod ffi { /// using the Gregorian Calendar. #[diplomat::rust_link(icu::datetime, Mod)] pub struct GregorianDateTimeFormatter( - pub icu_datetime::neo::FixedCalendarDateTimeFormatter< + pub icu_datetime::FixedCalendarDateTimeFormatter< icu_calendar::Gregorian, NeoYearMonthDayHourMinuteMarker, >, @@ -162,9 +162,9 @@ pub mod ffi { NeoYearMonthDayHourMinuteMarker::with_length(NeoSkeletonLength::from(length)); Ok(Box::new(GregorianDateTimeFormatter(call_constructor!( - icu_datetime::neo::FixedCalendarDateTimeFormatter::try_new, - icu_datetime::neo::FixedCalendarDateTimeFormatter::try_new_with_any_provider, - icu_datetime::neo::FixedCalendarDateTimeFormatter::try_new_with_buffer_provider, + icu_datetime::FixedCalendarDateTimeFormatter::try_new, + icu_datetime::FixedCalendarDateTimeFormatter::try_new_with_any_provider, + icu_datetime::FixedCalendarDateTimeFormatter::try_new_with_buffer_provider, provider, &locale, options @@ -186,7 +186,7 @@ pub mod ffi { /// An ICU4X DateFormatter object capable of formatting a [`Date`] as a string, /// using some calendar specified at runtime in the locale. #[diplomat::rust_link(icu::datetime, Mod)] - pub struct DateFormatter(pub icu_datetime::neo::DateTimeFormatter); + pub struct DateFormatter(pub icu_datetime::DateTimeFormatter); impl DateFormatter { /// Creates a new [`DateFormatter`] from locale data. @@ -201,9 +201,9 @@ pub mod ffi { let options = NeoYearMonthDayMarker::with_length(NeoSkeletonLength::from(length)); Ok(Box::new(DateFormatter(call_constructor!( - icu_datetime::neo::DateTimeFormatter::try_new, - icu_datetime::neo::DateTimeFormatter::try_new_with_any_provider, - icu_datetime::neo::DateTimeFormatter::try_new_with_buffer_provider, + icu_datetime::DateTimeFormatter::try_new, + icu_datetime::DateTimeFormatter::try_new_with_any_provider, + icu_datetime::DateTimeFormatter::try_new_with_buffer_provider, provider, &locale, options @@ -262,7 +262,7 @@ pub mod ffi { /// using some calendar specified at runtime in the locale. #[diplomat::rust_link(icu::datetime, Mod)] pub struct DateTimeFormatter( - pub icu_datetime::neo::DateTimeFormatter, + pub icu_datetime::DateTimeFormatter, ); impl DateTimeFormatter { @@ -279,9 +279,9 @@ pub mod ffi { NeoYearMonthDayHourMinuteMarker::with_length(NeoSkeletonLength::from(length)); Ok(Box::new(DateTimeFormatter(call_constructor!( - icu_datetime::neo::DateTimeFormatter::try_new, - icu_datetime::neo::DateTimeFormatter::try_new_with_any_provider, - icu_datetime::neo::DateTimeFormatter::try_new_with_buffer_provider, + icu_datetime::DateTimeFormatter::try_new, + icu_datetime::DateTimeFormatter::try_new_with_any_provider, + icu_datetime::DateTimeFormatter::try_new_with_buffer_provider, provider, &locale, options, diff --git a/ffi/capi/src/zoned_formatter.rs b/ffi/capi/src/zoned_formatter.rs index 801978acde..70dfa60572 100644 --- a/ffi/capi/src/zoned_formatter.rs +++ b/ffi/capi/src/zoned_formatter.rs @@ -24,7 +24,7 @@ pub mod ffi { /// An object capable of formatting a date time with time zone to a string. #[diplomat::rust_link(icu::datetime, Mod)] pub struct GregorianZonedDateTimeFormatter( - pub icu_datetime::neo::FixedCalendarDateTimeFormatter< + pub icu_datetime::FixedCalendarDateTimeFormatter< icu_calendar::Gregorian, NeoYearMonthDayHourMinuteSecondTimeZoneGenericShortMarker, >, @@ -49,9 +49,9 @@ pub mod ffi { Ok(Box::new(GregorianZonedDateTimeFormatter( call_constructor!( - icu_datetime::neo::FixedCalendarDateTimeFormatter::try_new, - icu_datetime::neo::FixedCalendarDateTimeFormatter::try_new_with_any_provider, - icu_datetime::neo::FixedCalendarDateTimeFormatter::try_new_with_buffer_provider, + icu_datetime::FixedCalendarDateTimeFormatter::try_new, + icu_datetime::FixedCalendarDateTimeFormatter::try_new_with_any_provider, + icu_datetime::FixedCalendarDateTimeFormatter::try_new_with_buffer_provider, provider, &locale, options @@ -81,7 +81,7 @@ pub mod ffi { /// An object capable of formatting a date time with time zone to a string. #[diplomat::rust_link(icu::datetime, Mod)] pub struct ZonedDateTimeFormatter( - pub icu_datetime::neo::DateTimeFormatter< + pub icu_datetime::DateTimeFormatter< NeoYearMonthDayHourMinuteSecondTimeZoneGenericShortMarker, >, ); @@ -104,9 +104,9 @@ pub mod ffi { ); Ok(Box::new(ZonedDateTimeFormatter(call_constructor!( - icu_datetime::neo::DateTimeFormatter::try_new, - icu_datetime::neo::DateTimeFormatter::try_new_with_any_provider, - icu_datetime::neo::DateTimeFormatter::try_new_with_buffer_provider, + icu_datetime::DateTimeFormatter::try_new, + icu_datetime::DateTimeFormatter::try_new_with_any_provider, + icu_datetime::DateTimeFormatter::try_new_with_buffer_provider, provider, &locale, options,