From 2804e85f565f1392086e5952d55708c2b7ceaa32 Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Thu, 12 Dec 2024 17:53:54 -0800 Subject: [PATCH] Bubble parts through FormattedUnit into FormattedDuration --- components/experimental/src/dimension/units/format.rs | 6 +++--- components/experimental/src/duration/format.rs | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/components/experimental/src/dimension/units/format.rs b/components/experimental/src/dimension/units/format.rs index a39ab1cac8f..0b9c81717d9 100644 --- a/components/experimental/src/dimension/units/format.rs +++ b/components/experimental/src/dimension/units/format.rs @@ -21,15 +21,15 @@ pub struct FormattedUnit<'l> { } impl Writeable for FormattedUnit<'_> { - fn write_to(&self, sink: &mut W) -> core::result::Result<(), core::fmt::Error> + fn write_to_parts(&self, sink: &mut W) -> core::result::Result<(), core::fmt::Error> where - W: core::fmt::Write + ?Sized, + W: writeable::PartsWrite + ?Sized, { self.display_name .patterns .get(self.value.into(), self.plural_rules) .interpolate((self.fixed_decimal_formatter.format(self.value),)) - .write_to(sink) + .write_to_parts(sink) } } diff --git a/components/experimental/src/duration/format.rs b/components/experimental/src/duration/format.rs index 868f5caa06b..925ec395c43 100644 --- a/components/experimental/src/duration/format.rs +++ b/components/experimental/src/duration/format.rs @@ -710,12 +710,16 @@ mod tests { [ (0, 6, parts::YEAR), (0, 6, icu_list::parts::ELEMENT), + (0, 1, icu_decimal::parts::MINUS_SIGN), + (1, 2, icu_decimal::parts::INTEGER), (6, 8, icu_list::parts::LITERAL), (8, 14, parts::MONTH), (8, 14, icu_list::parts::ELEMENT), + (8, 9, icu_decimal::parts::INTEGER), (14, 16, icu_list::parts::LITERAL), (16, 21, parts::WEEK), (16, 21, icu_list::parts::ELEMENT), + (16, 17, icu_decimal::parts::INTEGER), (21, 23, icu_list::parts::LITERAL), (23, 37, icu_list::parts::ELEMENT), (23, 25, icu_decimal::parts::INTEGER),