Skip to content

Commit 19e0df1

Browse files
committed
Rename SubsecondDigits enum variants
1 parent ce90aae commit 19e0df1

File tree

13 files changed

+189
-189
lines changed

13 files changed

+189
-189
lines changed

components/datetime/src/builder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@
8282
//! // Render for column alignment
8383
//!
8484
//! let static_field_set = fieldsets::T::short()
85-
//! .with_time_precision(TimePrecision::Subsecond(SubsecondDigits::F3))
85+
//! .with_time_precision(TimePrecision::Subsecond(SubsecondDigits::S3))
8686
//! .with_alignment(Alignment::Column)
8787
//! .zone(fieldsets::zone::SpecificLong);
8888
//!
8989
//! let mut builder = FieldSetBuilder::new();
9090
//! builder.length = Some(Length::Short);
91-
//! builder.time_precision = Some(TimePrecision::Subsecond(SubsecondDigits::F3));
91+
//! builder.time_precision = Some(TimePrecision::Subsecond(SubsecondDigits::S3));
9292
//! builder.alignment = Some(Alignment::Column);
9393
//! builder.zone_style = Some(ZoneStyle::SpecificLong);
9494
//! let dynamic_field_set = builder.build_composite().unwrap();

components/datetime/src/options/mod.rs

+58-58
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ impl IntoOption<YearStyle> for YearStyle {
340340
/// TimePrecision::Hour,
341341
/// TimePrecision::Minute,
342342
/// TimePrecision::Second,
343-
/// TimePrecision::Subsecond(SubsecondDigits::F2),
343+
/// TimePrecision::Subsecond(SubsecondDigits::S2),
344344
/// TimePrecision::MinuteOptional,
345345
/// ]
346346
/// .map(|time_precision| {
@@ -421,7 +421,7 @@ pub enum TimePrecision {
421421
/// Display the hour, minute, and second with the given number of
422422
/// fractional second digits.
423423
///
424-
/// Examples with [`SubsecondDigits::F1`]:
424+
/// Examples with [`SubsecondDigits::S1`]:
425425
///
426426
/// 1. `11:00:00.0 am`
427427
/// 2. `16:20:00.0`
@@ -451,15 +451,15 @@ enum TimePrecisionSerde {
451451
Hour,
452452
Minute,
453453
Second,
454-
SecondF1,
455-
SecondF2,
456-
SecondF3,
457-
SecondF4,
458-
SecondF5,
459-
SecondF6,
460-
SecondF7,
461-
SecondF8,
462-
SecondF9,
454+
SecondS1,
455+
SecondS2,
456+
SecondS3,
457+
SecondS4,
458+
SecondS5,
459+
SecondS6,
460+
SecondS7,
461+
SecondS8,
462+
SecondS9,
463463
MinuteOptional,
464464
}
465465

@@ -470,15 +470,15 @@ impl From<TimePrecision> for TimePrecisionSerde {
470470
TimePrecision::Hour => TimePrecisionSerde::Hour,
471471
TimePrecision::Minute => TimePrecisionSerde::Minute,
472472
TimePrecision::Second => TimePrecisionSerde::Second,
473-
TimePrecision::Subsecond(SubsecondDigits::F1) => TimePrecisionSerde::SecondF1,
474-
TimePrecision::Subsecond(SubsecondDigits::F2) => TimePrecisionSerde::SecondF2,
475-
TimePrecision::Subsecond(SubsecondDigits::F3) => TimePrecisionSerde::SecondF3,
476-
TimePrecision::Subsecond(SubsecondDigits::F4) => TimePrecisionSerde::SecondF4,
477-
TimePrecision::Subsecond(SubsecondDigits::F5) => TimePrecisionSerde::SecondF5,
478-
TimePrecision::Subsecond(SubsecondDigits::F6) => TimePrecisionSerde::SecondF6,
479-
TimePrecision::Subsecond(SubsecondDigits::F7) => TimePrecisionSerde::SecondF7,
480-
TimePrecision::Subsecond(SubsecondDigits::F8) => TimePrecisionSerde::SecondF8,
481-
TimePrecision::Subsecond(SubsecondDigits::F9) => TimePrecisionSerde::SecondF9,
473+
TimePrecision::Subsecond(SubsecondDigits::S1) => TimePrecisionSerde::SecondS1,
474+
TimePrecision::Subsecond(SubsecondDigits::S2) => TimePrecisionSerde::SecondS2,
475+
TimePrecision::Subsecond(SubsecondDigits::S3) => TimePrecisionSerde::SecondS3,
476+
TimePrecision::Subsecond(SubsecondDigits::S4) => TimePrecisionSerde::SecondS4,
477+
TimePrecision::Subsecond(SubsecondDigits::S5) => TimePrecisionSerde::SecondS5,
478+
TimePrecision::Subsecond(SubsecondDigits::S6) => TimePrecisionSerde::SecondS6,
479+
TimePrecision::Subsecond(SubsecondDigits::S7) => TimePrecisionSerde::SecondS7,
480+
TimePrecision::Subsecond(SubsecondDigits::S8) => TimePrecisionSerde::SecondS8,
481+
TimePrecision::Subsecond(SubsecondDigits::S9) => TimePrecisionSerde::SecondS9,
482482
TimePrecision::MinuteOptional => TimePrecisionSerde::MinuteOptional,
483483
}
484484
}
@@ -491,15 +491,15 @@ impl From<TimePrecisionSerde> for TimePrecision {
491491
TimePrecisionSerde::Hour => TimePrecision::Hour,
492492
TimePrecisionSerde::Minute => TimePrecision::Minute,
493493
TimePrecisionSerde::Second => TimePrecision::Second,
494-
TimePrecisionSerde::SecondF1 => TimePrecision::Subsecond(SubsecondDigits::F1),
495-
TimePrecisionSerde::SecondF2 => TimePrecision::Subsecond(SubsecondDigits::F2),
496-
TimePrecisionSerde::SecondF3 => TimePrecision::Subsecond(SubsecondDigits::F3),
497-
TimePrecisionSerde::SecondF4 => TimePrecision::Subsecond(SubsecondDigits::F4),
498-
TimePrecisionSerde::SecondF5 => TimePrecision::Subsecond(SubsecondDigits::F5),
499-
TimePrecisionSerde::SecondF6 => TimePrecision::Subsecond(SubsecondDigits::F6),
500-
TimePrecisionSerde::SecondF7 => TimePrecision::Subsecond(SubsecondDigits::F7),
501-
TimePrecisionSerde::SecondF8 => TimePrecision::Subsecond(SubsecondDigits::F8),
502-
TimePrecisionSerde::SecondF9 => TimePrecision::Subsecond(SubsecondDigits::F9),
494+
TimePrecisionSerde::SecondS1 => TimePrecision::Subsecond(SubsecondDigits::S1),
495+
TimePrecisionSerde::SecondS2 => TimePrecision::Subsecond(SubsecondDigits::S2),
496+
TimePrecisionSerde::SecondS3 => TimePrecision::Subsecond(SubsecondDigits::S3),
497+
TimePrecisionSerde::SecondS4 => TimePrecision::Subsecond(SubsecondDigits::S4),
498+
TimePrecisionSerde::SecondS5 => TimePrecision::Subsecond(SubsecondDigits::S5),
499+
TimePrecisionSerde::SecondS6 => TimePrecision::Subsecond(SubsecondDigits::S6),
500+
TimePrecisionSerde::SecondS7 => TimePrecision::Subsecond(SubsecondDigits::S7),
501+
TimePrecisionSerde::SecondS8 => TimePrecision::Subsecond(SubsecondDigits::S8),
502+
TimePrecisionSerde::SecondS9 => TimePrecision::Subsecond(SubsecondDigits::S9),
503503
TimePrecisionSerde::MinuteOptional => TimePrecision::MinuteOptional,
504504
}
505505
}
@@ -508,7 +508,7 @@ impl From<TimePrecisionSerde> for TimePrecision {
508508
/// A specification for how many fractional second digits to display.
509509
///
510510
/// For example, to display the time with millisecond precision, use
511-
/// [`SubsecondDigits::F3`].
511+
/// [`SubsecondDigits::S3`].
512512
///
513513
/// Lower-precision digits will be truncated.
514514
///
@@ -529,7 +529,7 @@ impl From<TimePrecisionSerde> for TimePrecision {
529529
/// let formatter = FixedCalendarDateTimeFormatter::<(), _>::try_new(
530530
/// locale!("en-US").into(),
531531
/// T::short().with_time_precision(TimePrecision::Subsecond(
532-
/// SubsecondDigits::F2,
532+
/// SubsecondDigits::S2,
533533
/// )),
534534
/// )
535535
/// .unwrap();
@@ -543,23 +543,23 @@ impl From<TimePrecisionSerde> for TimePrecision {
543543
#[non_exhaustive]
544544
pub enum SubsecondDigits {
545545
/// One fractional digit (tenths of a second).
546-
F1 = 1,
546+
S1 = 1,
547547
/// Two fractional digits (hundredths of a second).
548-
F2 = 2,
548+
S2 = 2,
549549
/// Three fractional digits (thousandths of a second).
550-
F3 = 3,
550+
S3 = 3,
551551
/// Four fractional digits.
552-
F4 = 4,
552+
S4 = 4,
553553
/// Five fractional digits.
554-
F5 = 5,
554+
S5 = 5,
555555
/// Six fractional digits.
556-
F6 = 6,
556+
S6 = 6,
557557
/// Seven fractional digits.
558-
F7 = 7,
558+
S7 = 7,
559559
/// Eight fractional digits.
560-
F8 = 8,
560+
S8 = 8,
561561
/// Nine fractional digits.
562-
F9 = 9,
562+
S9 = 9,
563563
}
564564

565565
/// An error from constructing [`SubsecondDigits`].
@@ -576,15 +576,15 @@ impl From<SubsecondDigits> for u8 {
576576
fn from(value: SubsecondDigits) -> u8 {
577577
use SubsecondDigits::*;
578578
match value {
579-
F1 => 1,
580-
F2 => 2,
581-
F3 => 3,
582-
F4 => 4,
583-
F5 => 5,
584-
F6 => 6,
585-
F7 => 7,
586-
F8 => 8,
587-
F9 => 9,
579+
S1 => 1,
580+
S2 => 2,
581+
S3 => 3,
582+
S4 => 4,
583+
S5 => 5,
584+
S6 => 6,
585+
S7 => 7,
586+
S8 => 8,
587+
S9 => 9,
588588
}
589589
}
590590
}
@@ -594,15 +594,15 @@ impl TryFrom<u8> for SubsecondDigits {
594594
fn try_from(value: u8) -> Result<Self, Self::Error> {
595595
use SubsecondDigits::*;
596596
match value {
597-
1 => Ok(F1),
598-
2 => Ok(F2),
599-
3 => Ok(F3),
600-
4 => Ok(F4),
601-
5 => Ok(F5),
602-
6 => Ok(F6),
603-
7 => Ok(F7),
604-
8 => Ok(F8),
605-
9 => Ok(F9),
597+
1 => Ok(S1),
598+
2 => Ok(S2),
599+
3 => Ok(S3),
600+
4 => Ok(S4),
601+
5 => Ok(S5),
602+
6 => Ok(S6),
603+
7 => Ok(S7),
604+
8 => Ok(S8),
605+
9 => Ok(S9),
606606
_ => Err(SubsecondError::OutOfRange),
607607
}
608608
}

components/datetime/src/parts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
//!
2323
//! let dtf = DateTimeFormatter::try_new(
2424
//! locale!("en-u-ca-buddhist").into(),
25-
//! fieldsets::YMDT::medium().with_time_precision(TimePrecision::Subsecond(SubsecondDigits::F2)).zone(fieldsets::zone::SpecificShort),
25+
//! fieldsets::YMDT::medium().with_time_precision(TimePrecision::Subsecond(SubsecondDigits::S2)).zone(fieldsets::zone::SpecificShort),
2626
//! )
2727
//! .unwrap();
2828
//!

components/datetime/src/provider/fields/components.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -739,15 +739,15 @@ impl Bag {
739739
_ => Numeric::Numeric,
740740
});
741741
bag.subsecond = Some(match decimal_second {
742-
fields::DecimalSecond::SecondF1 => F1,
743-
fields::DecimalSecond::SecondF2 => F2,
744-
fields::DecimalSecond::SecondF3 => F3,
745-
fields::DecimalSecond::SecondF4 => F4,
746-
fields::DecimalSecond::SecondF5 => F5,
747-
fields::DecimalSecond::SecondF6 => F6,
748-
fields::DecimalSecond::SecondF7 => F7,
749-
fields::DecimalSecond::SecondF8 => F8,
750-
fields::DecimalSecond::SecondF9 => F9,
742+
fields::DecimalSecond::SecondS1 => S1,
743+
fields::DecimalSecond::SecondS2 => S2,
744+
fields::DecimalSecond::SecondS3 => S3,
745+
fields::DecimalSecond::SecondS4 => S4,
746+
fields::DecimalSecond::SecondS5 => S5,
747+
fields::DecimalSecond::SecondS6 => S6,
748+
fields::DecimalSecond::SecondS7 => S7,
749+
fields::DecimalSecond::SecondS8 => S8,
750+
fields::DecimalSecond::SecondS9 => S9,
751751
});
752752
}
753753
FieldSymbol::TimeZone(time_zone_name) => {
@@ -796,7 +796,7 @@ mod test {
796796
hour: Some(Numeric::Numeric),
797797
minute: Some(Numeric::Numeric),
798798
second: Some(Numeric::Numeric),
799-
subsecond: Some(SubsecondDigits::F3),
799+
subsecond: Some(SubsecondDigits::S3),
800800

801801
..Default::default()
802802
};
@@ -809,7 +809,7 @@ mod test {
809809
(Symbol::Hour(fields::Hour::H23), Length::One).into(),
810810
(Symbol::Minute, Length::One).into(),
811811
(
812-
Symbol::DecimalSecond(fields::DecimalSecond::SecondF3),
812+
Symbol::DecimalSecond(fields::DecimalSecond::SecondS3),
813813
Length::One
814814
)
815815
.into(),

components/datetime/src/provider/fields/symbols.rs

+27-27
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@ impl FieldSymbol {
176176
pub(crate) fn from_subsecond_digits(subsecond_digits: SubsecondDigits) -> Self {
177177
use SubsecondDigits::*;
178178
match subsecond_digits {
179-
F1 => FieldSymbol::DecimalSecond(DecimalSecond::SecondF1),
180-
F2 => FieldSymbol::DecimalSecond(DecimalSecond::SecondF2),
181-
F3 => FieldSymbol::DecimalSecond(DecimalSecond::SecondF3),
182-
F4 => FieldSymbol::DecimalSecond(DecimalSecond::SecondF4),
183-
F5 => FieldSymbol::DecimalSecond(DecimalSecond::SecondF5),
184-
F6 => FieldSymbol::DecimalSecond(DecimalSecond::SecondF6),
185-
F7 => FieldSymbol::DecimalSecond(DecimalSecond::SecondF7),
186-
F8 => FieldSymbol::DecimalSecond(DecimalSecond::SecondF8),
187-
F9 => FieldSymbol::DecimalSecond(DecimalSecond::SecondF9),
179+
S1 => FieldSymbol::DecimalSecond(DecimalSecond::SecondS1),
180+
S2 => FieldSymbol::DecimalSecond(DecimalSecond::SecondS2),
181+
S3 => FieldSymbol::DecimalSecond(DecimalSecond::SecondS3),
182+
S4 => FieldSymbol::DecimalSecond(DecimalSecond::SecondS4),
183+
S5 => FieldSymbol::DecimalSecond(DecimalSecond::SecondS5),
184+
S6 => FieldSymbol::DecimalSecond(DecimalSecond::SecondS6),
185+
S7 => FieldSymbol::DecimalSecond(DecimalSecond::SecondS7),
186+
S8 => FieldSymbol::DecimalSecond(DecimalSecond::SecondS8),
187+
S9 => FieldSymbol::DecimalSecond(DecimalSecond::SecondS9),
188188
}
189189
}
190190

@@ -301,15 +301,15 @@ impl FieldSymbol {
301301
Self::Minute => 22,
302302
Self::Second(Second::Second) => 23,
303303
Self::Second(Second::MillisInDay) => 24,
304-
Self::DecimalSecond(DecimalSecond::SecondF1) => 31,
305-
Self::DecimalSecond(DecimalSecond::SecondF2) => 32,
306-
Self::DecimalSecond(DecimalSecond::SecondF3) => 33,
307-
Self::DecimalSecond(DecimalSecond::SecondF4) => 34,
308-
Self::DecimalSecond(DecimalSecond::SecondF5) => 35,
309-
Self::DecimalSecond(DecimalSecond::SecondF6) => 36,
310-
Self::DecimalSecond(DecimalSecond::SecondF7) => 37,
311-
Self::DecimalSecond(DecimalSecond::SecondF8) => 38,
312-
Self::DecimalSecond(DecimalSecond::SecondF9) => 39,
304+
Self::DecimalSecond(DecimalSecond::SecondS1) => 31,
305+
Self::DecimalSecond(DecimalSecond::SecondS2) => 32,
306+
Self::DecimalSecond(DecimalSecond::SecondS3) => 33,
307+
Self::DecimalSecond(DecimalSecond::SecondS4) => 34,
308+
Self::DecimalSecond(DecimalSecond::SecondS5) => 35,
309+
Self::DecimalSecond(DecimalSecond::SecondS6) => 36,
310+
Self::DecimalSecond(DecimalSecond::SecondS7) => 37,
311+
Self::DecimalSecond(DecimalSecond::SecondS8) => 38,
312+
Self::DecimalSecond(DecimalSecond::SecondS9) => 39,
313313
Self::TimeZone(TimeZone::SpecificNonLocation) => 100,
314314
Self::TimeZone(TimeZone::LocalizedOffset) => 102,
315315
Self::TimeZone(TimeZone::GenericNonLocation) => 103,
@@ -784,23 +784,23 @@ impl LengthType for TimeZone {
784784
#[allow(clippy::exhaustive_enums)] // used in data struct
785785
pub enum DecimalSecond {
786786
/// A second with 1 fractional digit: "1.0"
787-
SecondF1 = 1,
787+
SecondS1 = 1,
788788
/// A second with 2 fractional digits: "1.00"
789-
SecondF2 = 2,
789+
SecondS2 = 2,
790790
/// A second with 3 fractional digits: "1.000"
791-
SecondF3 = 3,
791+
SecondS3 = 3,
792792
/// A second with 4 fractional digits: "1.0000"
793-
SecondF4 = 4,
793+
SecondS4 = 4,
794794
/// A second with 5 fractional digits: "1.00000"
795-
SecondF5 = 5,
795+
SecondS5 = 5,
796796
/// A second with 6 fractional digits: "1.000000"
797-
SecondF6 = 6,
797+
SecondS6 = 6,
798798
/// A second with 7 fractional digits: "1.0000000"
799-
SecondF7 = 7,
799+
SecondS7 = 7,
800800
/// A second with 8 fractional digits: "1.00000000"
801-
SecondF8 = 8,
801+
SecondS8 = 8,
802802
/// A second with 9 fractional digits: "1.000000000"
803-
SecondF9 = 9,
803+
SecondS9 = 9,
804804
}
805805

806806
impl DecimalSecond {

0 commit comments

Comments
 (0)