Skip to content

Commit

Permalink
Document implementable/unimplementable
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Jan 16, 2025
1 parent 48d81ae commit 6fe6152
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/collections/src/codepointtrie/cptrie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ pub enum TrieType {

/// A trait representing the values stored in the data array of a [`CodePointTrie`].
/// This trait is used as a type parameter in constructing a `CodePointTrie`.
///
/// This trait can be implemented on anything that can be represented as a u32s worth of data.
pub trait TrieValue: Copy + Eq + PartialEq + zerovec::ule::AsULE + 'static {
/// Last-resort fallback value to return if we cannot read data from the trie.
///
Expand Down
3 changes: 3 additions & 0 deletions components/datetime/src/scaffold/calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ impl_load_any_calendar!([
]);

/// A type that can be converted into a specific calendar system.
// This trait is implementable
pub trait ConvertCalendar {
/// The converted type. This can be the same as the receiver type.
type Converted<'a>: Sized;
Expand Down Expand Up @@ -441,6 +442,7 @@ impl<O: TimeZoneModel> ConvertCalendar for TimeZoneInfo<O> {
}

/// An input that may be associated with a specific runtime calendar.
// This trait is implementable
pub trait InSameCalendar {
/// Checks whether this type is compatible with the given calendar.
///
Expand Down Expand Up @@ -514,6 +516,7 @@ impl<O: TimeZoneModel> InSameCalendar for TimeZoneInfo<O> {
}

/// An input associated with a fixed, static calendar.
// This trait is implementable
pub trait InFixedCalendar<C> {}

impl<C: CldrCalendar, A: AsCalendar<Calendar = C>> InFixedCalendar<C> for Date<A> {}
Expand Down
5 changes: 5 additions & 0 deletions components/datetime/src/scaffold/fieldset_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ pub trait DateTimeMarkers: Sealed + DateTimeNamesMarker {
/// - [`TimeZoneInfo`](icu_timezone::TimeZoneInfo)
///
/// [`fieldsets::YMD`]: crate::fieldsets::YMD
// This trait is implicitly sealed due to its blanket impl
pub trait AllInputMarkers<R: DateTimeMarkers>:
GetField<<R::D as DateInputMarkers>::YearInput>
+ GetField<<R::D as DateInputMarkers>::MonthInput>
Expand Down Expand Up @@ -204,6 +205,7 @@ where
///
/// This trait is implemented on all providers that support datetime formatting,
/// including [`crate::provider::Baked`].
// This trait is implicitly sealed due to its blanket impl
pub trait AllFixedCalendarFormattingDataMarkers<C: CldrCalendar, FSet: DateTimeMarkers>:
DataProvider<<FSet::D as TypedDateDataMarkers<C>>::YearNamesV1Marker>
+ DataProvider<<FSet::D as TypedDateDataMarkers<C>>::MonthNamesV1Marker>
Expand Down Expand Up @@ -256,6 +258,7 @@ where
///
/// This trait is implemented on all providers that support datetime formatting,
/// including [`crate::provider::Baked`].
// This trait is implicitly sealed due to its blanket impl
pub trait AllAnyCalendarFormattingDataMarkers<FSet: DateTimeMarkers>:
DataProvider<<<FSet::D as DateDataMarkers>::Year as CalMarkers<YearNamesV1Marker>>::Buddhist>
+ DataProvider<<<FSet::D as DateDataMarkers>::Year as CalMarkers<YearNamesV1Marker>>::Chinese>
Expand Down Expand Up @@ -400,6 +403,7 @@ where

/// Trait to consolidate data provider markers external to this crate
/// for datetime formatting with a fixed calendar.
// This trait is implicitly sealed due to its blanket impl
pub trait AllFixedCalendarExternalDataMarkers:
DataProvider<DecimalSymbolsV2Marker> + DataProvider<DecimalDigitsV1Marker>
{
Expand All @@ -412,6 +416,7 @@ impl<T> AllFixedCalendarExternalDataMarkers for T where

/// Trait to consolidate data provider markers external to this crate
/// for datetime formatting with any calendar.
// This trait is implicitly sealed due to its blanket impl
pub trait AllAnyCalendarExternalDataMarkers:
DataProvider<ChineseCacheV1Marker>
+ DataProvider<DangiCacheV1Marker>
Expand Down
1 change: 1 addition & 0 deletions components/datetime/src/scaffold/names_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ where
/// is_trait_implemented::<TimeFieldSet, CompositeFieldSet>();
/// ```
#[allow(missing_docs)]
// This trait is implicitly sealed by deriving from a sealed trait
pub trait DateTimeNamesFrom<M: DateTimeNamesMarker>: DateTimeNamesMarker {
fn map_year_names(
other: <M::YearNames as NamesContainer<YearNamesV1Marker, YearNameLength>>::Container,
Expand Down
2 changes: 2 additions & 0 deletions components/pattern/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ pub trait PatternBackend: crate::private::Sealed + 'static + core::fmt::Debug {
/// This trait can add [`Part`]s for individual literals or placeholders. The implementations
/// of this trait on standard types do not add any [`Part`]s.
///
/// This trait is not implementable by user code due to the blanket impl.
///
/// # Examples
///
/// A custom implementation that adds parts:
Expand Down
1 change: 1 addition & 0 deletions components/properties/src/names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ pub trait ParseableEnumeratedProperty: crate::private::Sealed + TrieValue {
}

// Abstract over Linear/Sparse/Script representation
// This trait is implicitly sealed by not being exported.
pub trait PropertyEnumToValueNameLookup {
fn get(&self, prop: u32) -> Option<&str>;
}
Expand Down

0 comments on commit 6fe6152

Please sign in to comment.