Skip to content

Commit

Permalink
Internal refactor of DateTimeFormatter (#6244)
Browse files Browse the repository at this point in the history
Organizes the inner workings without impacting stack size. I've wanted
to do this for a while and #6243 was the impetus.
  • Loading branch information
sffc authored Mar 6, 2025
1 parent bda5240 commit 788852e
Show file tree
Hide file tree
Showing 2 changed files with 247 additions and 384 deletions.
12 changes: 11 additions & 1 deletion components/datetime/src/provider/packed_pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,16 @@ icu_provider::data_marker!(
/// This supports a set of "standard" patterns plus up to two "variants".
/// The variants are currently used by year formatting:
///
/// - Standard: Year, which could be partial precision (2-digit Gregorain)
/// - Standard: Year, which could be partial precision (2-digit Gregorian)
/// - Variant 0: Full Year, which is always full precision
/// - Variant 1: Year With Era
///
/// And by time formatting:
///
/// - Standard: Hour only
/// - Variant 0: Hour and minute
/// - Variant 1: Hour, minute, and second
///
/// Variants should be used when the pattern could depend on the value being
/// formatted. For example, with [`YearStyle::Auto`], any of these three
/// patterns could be selected based on the year value.
Expand Down Expand Up @@ -457,9 +463,13 @@ impl PackedPatternsBuilder<'_> {
}
}

/// Which pattern to select. For details, see [`PackedPatterns`].
pub(crate) enum PackedSkeletonVariant {
/// Default-precision year OR hours only
Standard,
/// Full-precision year OR hours and minutes
Variant0,
/// Year with era OR hours, minutes, and seconds
Variant1,
}

Expand Down
Loading

0 comments on commit 788852e

Please sign in to comment.