| 1 |
// This file is part of ICU4X. For terms of use, please see the file |
| 2 |
// called LICENSE at the top level of the ICU4X source tree |
| 3 |
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). |
| 4 |
|
| 5 |
//! UTS 35 classical datetime skeletons. |
| 6 |
//! |
| 7 |
//! Semantic skeletons (field sets) use classical skeletons for pattern matching in datagen. |
| 8 |
//! |
| 9 |
//! See [`Skeleton`](reference::Skeleton) and [`Bag`](components::Bag) for more information. |
| 10 |
//! |
| 11 |
//! ✨ *Enabled with the `datagen` Cargo feature.* |
| 12 |
//! |
| 13 |
//! # Implementation status |
| 14 |
//! |
| 15 |
//! This is currently only a partial implementation of the UTS-35 skeleton matching algorithm. |
| 16 |
//! |
| 17 |
//! | Algorithm step | Status | |
| 18 |
//! |----------------|--------| |
| 19 |
//! | Match skeleton fields according to a ranking | Implemented | |
| 20 |
//! | Adjust the matched pattern to have certain widths | Implemented | |
| 21 |
//! | Match date and times separately, and them combine them | Implemented | |
| 22 |
//! | Use appendItems to fill in a pattern with missing fields | Not yet, and may not be fully implemented. See [issue #586](https://github.com/unicode-org/icu4x/issues/586) | |
| 23 |
//! |
| 24 |
//! # Description |
| 25 |
//! |
| 26 |
//! A [`components::Bag`] is a model of encoding information on how to format date |
| 27 |
//! and time by specifying a list of components the user wants to be visible in the formatted string |
| 28 |
//! and how each field should be displayed. |
| 29 |
//! |
| 30 |
//! This model closely corresponds to `ECMA402` API and allows for high level of customization |
| 31 |
//! compared to `Length` model. |
| 32 |
//! |
| 33 |
//! Additionally, the bag contains an optional set of `Preferences` which represent user |
| 34 |
//! preferred adjustments that can be applied onto the pattern right before formatting. |
| 35 |
//! |
| 36 |
//! ## Pattern Selection |
| 37 |
//! |
| 38 |
//! The [`components::Bag`] is a way for the developer to describe which components |
| 39 |
//! should be included in in a datetime, and how they should be displayed. There is not a strict |
| 40 |
//! guarantee in how the final date will be displayed to the end user. The user's preferences and |
| 41 |
//! locale information can override the developer preferences. |
| 42 |
//! |
| 43 |
//! The fields in the [`components::Bag`] are matched against available patterns in |
| 44 |
//! the `CLDR` locale data. A best fit is found, and presented to the user. This means that in |
| 45 |
//! certain situations, and component combinations, fields will not have a match, or the match will |
| 46 |
//! have a different type of presentation for a given locale. |
| 47 |
//! |
| 48 |
//! <div class="stab unstable"> |
| 49 |
//! 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, |
| 50 |
//! including in SemVer minor releases. While the serde representation of data structs is guaranteed |
| 51 |
//! to be stable, their Rust representation might not be. Use with caution. |
| 52 |
//! </div> |
| 53 |
|
| 54 |
#[cfg(doc)] |
| 55 |
use crate::provider::fields::components; |
| 56 |
|
| 57 |
mod error; |
| 58 |
mod generic_length_patterns; |
| 59 |
mod helpers; |
| 60 |
pub mod reference; |
| 61 |
pub mod runtime; |
| 62 |
#[cfg(feature = "serde")] |
| 63 |
mod serde; |
| 64 |
|
| 65 |
pub use error::*; |
| 66 |
pub use generic_length_patterns::*; |
| 67 |
pub use helpers::*; |