| 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 |
//! Scaffolding traits and types for the datetime crate. |
| 6 |
//! |
| 7 |
//! Items in this module are mostly for trait bounds. Most users should not need to reference |
| 8 |
//! these items in userland code. |
| 9 |
//! |
| 10 |
//! # Implementing a custom input type |
| 11 |
//! |
| 12 |
//! One reason you might find yourself in this module is because you have a custom datetime |
| 13 |
//! type, and you want to plug it into ICU4X for formatting. |
| 14 |
//! |
| 15 |
//! To properly equip your type for ICU4X, implement the following traits: |
| 16 |
//! |
| 17 |
//! - [`UnstableSealed`] must always be implemented to acknowledge that these traits are |
| 18 |
//! subject to change, even across minor releases. |
| 19 |
//! - [`GetField<()>`] must almost always be implemented. It is used as a placeholder for input fields that a particular fieldset does not require. |
| 20 |
//! - Additional [`GetField`] impls based on what fields your type contains. For a list of all possible fields, see [`AllInputMarkers`]. |
| 21 |
//! - [`ConvertCalendar`], for [`DateTimeFormatter::format`](crate::DateTimeFormatter::format) |
| 22 |
//! - [`InSameCalendar`], for [`DateTimeFormatter::format_same_calendar`](crate::DateTimeFormatter::format_same_calendar) |
| 23 |
//! - [`InFixedCalendar`], for [`FixedCalendarDateTimeFormatter::format`](crate::FixedCalendarDateTimeFormatter::format) |
| 24 |
|
| 25 |
mod calendar; |
| 26 |
mod dynamic_impls; |
| 27 |
mod fieldset_traits; |
| 28 |
mod get_field; |
| 29 |
mod names_storage; |
| 30 |
|
| 31 |
pub use calendar::CalMarkers; |
| 32 |
pub use calendar::CldrCalendar; |
| 33 |
pub use calendar::ConvertCalendar; |
| 34 |
pub(crate) use calendar::FormattableAnyCalendar; |
| 35 |
pub(crate) use calendar::FormattableAnyCalendarNamesLoader; |
| 36 |
pub use calendar::FormattableHijriRules; |
| 37 |
pub use calendar::FullDataCalMarkers; |
| 38 |
pub use calendar::InFixedCalendar; |
| 39 |
pub use calendar::InSameCalendar; |
| 40 |
pub use calendar::IntoFormattableAnyCalendar; |
| 41 |
pub use calendar::NoDataCalMarkers; |
| 42 |
|
| 43 |
pub use fieldset_traits::AllAnyCalendarExternalDataMarkers; |
| 44 |
pub use fieldset_traits::AllAnyCalendarFormattingDataMarkers; |
| 45 |
pub use fieldset_traits::AllAnyCalendarPatternDataMarkers; |
| 46 |
pub use fieldset_traits::AllAnyCalendarRangePatternDataMarkers; |
| 47 |
pub use fieldset_traits::AllFixedCalendarExternalDataMarkers; |
| 48 |
pub use fieldset_traits::AllFixedCalendarFormattingDataMarkers; |
| 49 |
pub use fieldset_traits::AllFixedCalendarPatternDataMarkers; |
| 50 |
pub use fieldset_traits::AllFixedCalendarRangePatternDataMarkers; |
| 51 |
pub use fieldset_traits::AllInputMarkers; |
| 52 |
pub use fieldset_traits::DateDataMarkers; |
| 53 |
pub use fieldset_traits::DateInputMarkers; |
| 54 |
pub use fieldset_traits::DateTimeMarkers; |
| 55 |
pub use fieldset_traits::TimeMarkers; |
| 56 |
pub use fieldset_traits::TypedDateDataMarkers; |
| 57 |
pub use fieldset_traits::ZoneMarkers; |
| 58 |
pub(crate) use fieldset_traits::datetime_marker_helper; |
| 59 |
|
| 60 |
pub use get_field::GetField; |
| 61 |
|
| 62 |
pub use names_storage::DataPayloadWithVariables; |
| 63 |
pub use names_storage::DataPayloadWithVariablesBorrowed; |
| 64 |
pub use names_storage::DateTimeNamesFrom; |
| 65 |
pub use names_storage::DateTimeNamesMarker; |
| 66 |
pub use names_storage::MaybePayload; |
| 67 |
pub use names_storage::MaybePayloadError; |
| 68 |
pub use names_storage::NamesContainer; |
| 69 |
pub(crate) use names_storage::OptionalNames; |
| 70 |
|
| 71 |
/// Trait marking other traits that are considered unstable and should not generally be |
| 72 |
/// implemented outside of the datetime crate. |
| 73 |
/// |
| 74 |
/// <div class="stab unstable"> |
| 75 |
/// 🚧 This trait is considered unstable; it may change at any time, in breaking or non-breaking ways, |
| 76 |
/// including in SemVer minor releases. Do not implement this trait in userland unless you are prepared for things to occasionally break. |
| 77 |
/// </div> |
| 78 |
pub trait UnstableSealed {} |