Skip to content

Commit 5eed624

Browse files
authored
Mark Calendar UnstableSealed (#6483)
Note: I used a different header than in datetime for the trait, since I think unlike datetime this is a non-scaffolding trait that people will reference often. Personally my rule of thumb for UnstableSealed is that we expect people to want to implement it (check) and we have some idea that this is the direction in which we want to go for custom impls. I hadn't put full thought into that in the past for this crate but with some of the formatting stuff split out I'm more confident. So I'm fine with this being unstable sealed. I'm not sure if UnstableSealed should live in the cal module or at the top level. <!-- Thank you for your pull request to ICU4X! Reminder: try to use [Conventional Comments](https://conventionalcomments.org/) to make comments clearer. Please see https://github.com/unicode-org/icu4x/blob/main/CONTRIBUTING.md for general information on contributing to ICU4X. -->
1 parent caa8799 commit 5eed624

File tree

17 files changed

+38
-3
lines changed

17 files changed

+38
-3
lines changed

components/calendar/src/any_calendar.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ macro_rules! match_cal {
218218
};
219219
}
220220

221+
impl crate::cal::scaffold::UnstableSealed for AnyCalendar {}
221222
impl Calendar for AnyCalendar {
222223
type DateInner = AnyDateInner;
223224
type Year = YearInfo;

components/calendar/src/cal/buddhist.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const BUDDHIST_ERA_OFFSET: i32 = 543;
4949
#[allow(clippy::exhaustive_structs)] // this type is stable
5050
pub struct Buddhist;
5151

52+
impl crate::cal::scaffold::UnstableSealed for Buddhist {}
5253
impl Calendar for Buddhist {
5354
type DateInner = IsoDateInner;
5455
type Year = types::EraYear;

components/calendar/src/cal/chinese.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ impl Chinese {
151151
pub(crate) const DEBUG_NAME: &'static str = "Chinese";
152152
}
153153

154+
impl crate::cal::scaffold::UnstableSealed for Chinese {}
154155
impl Calendar for Chinese {
155156
type DateInner = ChineseDateInner;
156157
type Year = types::CyclicYear;

components/calendar/src/cal/coptic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ impl CalendarArithmetic for Coptic {
9292
}
9393
}
9494

95+
impl crate::cal::scaffold::UnstableSealed for Coptic {}
9596
impl Calendar for Coptic {
9697
type DateInner = CopticDateInner;
9798
type Year = types::EraYear;

components/calendar/src/cal/dangi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ impl Dangi {
149149
pub(crate) const DEBUG_NAME: &'static str = "Dangi";
150150
}
151151

152+
impl crate::cal::scaffold::UnstableSealed for Dangi {}
152153
impl Calendar for Dangi {
153154
type DateInner = DangiDateInner;
154155
type Year = CyclicYear;

components/calendar/src/cal/ethiopian.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ impl CalendarArithmetic for Ethiopian {
110110
}
111111
}
112112

113+
impl crate::cal::scaffold::UnstableSealed for Ethiopian {}
113114
impl Calendar for Ethiopian {
114115
type DateInner = EthiopianDateInner;
115116
type Year = types::EraYear;

components/calendar/src/cal/gregorian.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub struct Gregorian;
4444
/// The inner date type used for representing [`Date`]s of [`Gregorian`]. See [`Date`] and [`Gregorian`] for more details.
4545
pub struct GregorianDateInner(pub(crate) IsoDateInner);
4646

47+
impl crate::cal::scaffold::UnstableSealed for Gregorian {}
4748
impl Calendar for Gregorian {
4849
type DateInner = GregorianDateInner;
4950
type Year = types::EraYear;

components/calendar/src/cal/hebrew.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ impl PrecomputedDataSource<HebrewYearInfo> for () {
130130
}
131131
}
132132

133+
impl crate::cal::scaffold::UnstableSealed for Hebrew {}
133134
impl Calendar for Hebrew {
134135
type DateInner = HebrewDateInner;
135136
type Year = types::EraYear;

components/calendar/src/cal/hijri.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ impl CalendarArithmetic for HijriSimulated {
361361
}
362362
}
363363

364+
impl crate::cal::scaffold::UnstableSealed for HijriSimulated {}
364365
impl Calendar for HijriSimulated {
365366
type DateInner = HijriSimulatedDateInner;
366367
type Year = types::EraYear;
@@ -642,6 +643,7 @@ impl CalendarArithmetic for HijriUmmAlQura {
642643
}
643644
}
644645

646+
impl crate::cal::scaffold::UnstableSealed for HijriUmmAlQura {}
645647
impl Calendar for HijriUmmAlQura {
646648
type DateInner = HijriUmmAlQuraDateInner;
647649
type Year = types::EraYear;
@@ -1171,6 +1173,7 @@ impl CalendarArithmetic for HijriTabular {
11711173
}
11721174
}
11731175

1176+
impl crate::cal::scaffold::UnstableSealed for HijriTabular {}
11741177
impl Calendar for HijriTabular {
11751178
type DateInner = HijriTabularDateInner;
11761179
type Year = types::EraYear;

components/calendar/src/cal/indian.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const DAY_OFFSET: u16 = 80;
9090
/// The Saka calendar is 78 years behind Gregorian. This number should be added to Gregorian dates
9191
const YEAR_OFFSET: i32 = 78;
9292

93+
impl crate::cal::scaffold::UnstableSealed for Indian {}
9394
impl Calendar for Indian {
9495
type DateInner = IndianDateInner;
9596
type Year = types::EraYear;

0 commit comments

Comments
 (0)