Skip to content

Commit 402c006

Browse files
authored
Change .time, .zone to .with_time, .with_zone (#6471)
#6022
1 parent f837f9a commit 402c006

File tree

18 files changed

+196
-196
lines changed

18 files changed

+196
-196
lines changed

components/datetime/README.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/datetime/src/builder.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
//! let static_field_set = fieldsets::T::short()
7979
//! .with_time_precision(TimePrecision::Subsecond(SubsecondDigits::S3))
8080
//! .with_alignment(Alignment::Column)
81-
//! .zone(fieldsets::zone::SpecificLong);
81+
//! .with_zone(fieldsets::zone::SpecificLong);
8282
//!
8383
//! let mut builder = FieldSetBuilder::new();
8484
//! builder.length = Some(Length::Short);
@@ -604,7 +604,7 @@ impl FieldSetBuilder {
604604
pub fn build_zoned_date(mut self) -> Result<ZonedDateFieldSet, BuilderError> {
605605
let zone_field_set = self.build_zone_without_checking_options()?;
606606
let date_field_set = self.build_date()?;
607-
Ok(date_field_set.zone(zone_field_set))
607+
Ok(date_field_set.with_zone(zone_field_set))
608608
}
609609

610610
/// Builds a [`Combo`] for a zoned time.
@@ -613,7 +613,7 @@ impl FieldSetBuilder {
613613
pub fn build_zoned_time(mut self) -> Result<ZonedTimeFieldSet, BuilderError> {
614614
let zone_field_set = self.build_zone_without_checking_options()?;
615615
let time_field_set = self.build_time()?;
616-
Ok(time_field_set.zone(zone_field_set))
616+
Ok(time_field_set.with_zone(zone_field_set))
617617
}
618618

619619
/// Builds a [`Combo`] for a zoned date and time.
@@ -622,7 +622,7 @@ impl FieldSetBuilder {
622622
pub fn build_zoned_date_and_time(mut self) -> Result<ZonedDateAndTimeFieldSet, BuilderError> {
623623
let zone_field_set = self.build_zone_without_checking_options()?;
624624
let datetime_field_set = self.build_date_and_time()?;
625-
Ok(datetime_field_set.zone(zone_field_set))
625+
Ok(datetime_field_set.with_zone(zone_field_set))
626626
}
627627

628628
/// Builds a [`CompositeFieldSet`].

components/datetime/src/combo.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::{provider::neo::*, scaffold::*};
1616
/// ```
1717
/// use icu::datetime::fieldsets::{zone::Location, Combo, E};
1818
///
19-
/// let field_set = E::long().zone(Location);
19+
/// let field_set = E::long().with_zone(Location);
2020
/// ```
2121
///
2222
/// Format the weekday, hour, and location-based zone:
@@ -32,7 +32,7 @@ use crate::{provider::neo::*, scaffold::*};
3232
/// // Note: Combo type can be elided, but it is shown here for demonstration
3333
/// let formatter = DateTimeFormatter::<Combo<fieldsets::ET, zone::Location>>::try_new(
3434
/// locale!("en-US").into(),
35-
/// fieldsets::E::short().time_hm().zone(zone::Location),
35+
/// fieldsets::E::short().with_time_hm().with_zone(zone::Location),
3636
/// )
3737
/// .unwrap();
3838
///
@@ -64,7 +64,7 @@ use crate::{provider::neo::*, scaffold::*};
6464
/// let formatter =
6565
/// FixedCalendarDateTimeFormatter::<_, Combo<fieldsets::ET, zone::Location>>::try_new(
6666
/// locale!("en-US").into(),
67-
/// fieldsets::E::short().time_hm().zone(zone::Location),
67+
/// fieldsets::E::short().with_time_hm().with_zone(zone::Location),
6868
/// )
6969
/// .unwrap();
7070
///
@@ -98,7 +98,7 @@ use crate::{provider::neo::*, scaffold::*};
9898
/// let formatter =
9999
/// DateTimeFormatter::<Combo<DateFieldSet, GenericShort>>::try_new(
100100
/// locale!("en-US").into(),
101-
/// DateFieldSet::YMD(YMD::long()).zone(GenericShort),
101+
/// DateFieldSet::YMD(YMD::long()).with_zone(GenericShort),
102102
/// )
103103
/// .unwrap();
104104
///
@@ -125,7 +125,7 @@ use crate::{provider::neo::*, scaffold::*};
125125
///
126126
/// let formatter = FixedCalendarDateTimeFormatter::try_new(
127127
/// locale!("en-US").into(),
128-
/// T::medium().zone(SpecificLong),
128+
/// T::medium().with_zone(SpecificLong),
129129
/// )
130130
/// .unwrap();
131131
///

components/datetime/src/dynamic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
//!
3939
//! fn get_field_set(should_display_time: bool) -> CompositeDateTimeFieldSet {
4040
//! if should_display_time {
41-
//! let field_set = fieldsets::MD::medium().time_hm();
41+
//! let field_set = fieldsets::MD::medium().with_time_hm();
4242
//! CompositeDateTimeFieldSet::DateTime(
4343
//! fieldsets::enums::DateAndTimeFieldSet::MDT(field_set),
4444
//! )

components/datetime/src/fieldsets.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ macro_rules! impl_date_to_time_helpers {
294294
) => {
295295
impl $type {
296296
/// Associates this field set with a time precision.
297-
pub fn time(self, time_precision: TimePrecision) -> $type_time {
297+
pub fn with_time(self, time_precision: TimePrecision) -> $type_time {
298298
$type_time {
299299
length: self.length,
300300
time_precision: Some(time_precision),
@@ -303,7 +303,7 @@ macro_rules! impl_date_to_time_helpers {
303303
}
304304
}
305305
/// Shorthand to associate this field set with [`TimePrecision::Minute`].
306-
pub fn time_hm(self) -> $type_time {
306+
pub fn with_time_hm(self) -> $type_time {
307307
$type_time {
308308
length: self.length,
309309
time_precision: Some(TimePrecision::Minute),
@@ -312,7 +312,7 @@ macro_rules! impl_date_to_time_helpers {
312312
}
313313
}
314314
/// Shorthand to associate this field set with [`TimePrecision::Second`].
315-
pub fn time_hms(self) -> $type_time {
315+
pub fn with_time_hms(self) -> $type_time {
316316
$type_time {
317317
length: self.length,
318318
time_precision: Some(TimePrecision::Second),
@@ -353,7 +353,7 @@ macro_rules! impl_zone_combo_helpers {
353353
impl $type {
354354
#[inline]
355355
/// Associates this field set with a time zone field set.
356-
pub fn zone<Z: ZoneMarkers>(self, zone: Z) -> Combo<Self, Z> {
356+
pub fn with_zone<Z: ZoneMarkers>(self, zone: Z) -> Combo<Self, Z> {
357357
Combo::new(self, zone)
358358
}
359359
}
@@ -1311,7 +1311,7 @@ pub mod zone {
13111311
///
13121312
/// let formatter = FixedCalendarDateTimeFormatter::try_new(
13131313
/// locale!("en-US").into(),
1314-
/// T::medium().zone(SpecificShort),
1314+
/// T::medium().with_zone(SpecificShort),
13151315
/// )
13161316
/// .unwrap();
13171317
///

components/datetime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
//! use writeable::assert_writeable_eq;
5858
//!
5959
//! // Field set for year, month, day, hour, and minute with a medium length:
60-
//! let field_set = fieldsets::YMD::medium().time_hm();
60+
//! let field_set = fieldsets::YMD::medium().with_time_hm();
6161
//!
6262
//! // Create a formatter for Argentinian Spanish:
6363
//! let locale = locale!("es-AR");

components/datetime/src/neo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ impl<C: CldrCalendar, FSet: DateTimeMarkers> FixedCalendarDateTimeFormatter<C, F
943943
/// // Create a simple YMDT formatter:
944944
/// let formatter = FixedCalendarDateTimeFormatter::try_new(
945945
/// locale!("und").into(),
946-
/// YMD::long().time_hm().with_alignment(Alignment::Column)
946+
/// YMD::long().with_time_hm().with_alignment(Alignment::Column)
947947
/// )
948948
/// .unwrap();
949949
///

components/datetime/src/parts.rs

Lines changed: 1 addition & 1 deletion
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::S2)).zone(fieldsets::zone::SpecificShort),
25+
//! fieldsets::YMDT::medium().with_time_precision(TimePrecision::Subsecond(SubsecondDigits::S2)).with_zone(fieldsets::zone::SpecificShort),
2626
//! )
2727
//! .unwrap();
2828
//!

components/datetime/src/pattern/names.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ impl<C: CldrCalendar, FSet: DateTimeNamesMarker> FixedCalendarDateTimeNames<C, F
847847
/// // This assumes that the locale uses Abbreviated names for the given semantic skeleton!
848848
/// let mut names = FixedCalendarDateTimeNames::from_formatter(prefs, formatter).cast_into_fset::<YMDT>();
849849
/// names.include_day_period_names(DayPeriodNameLength::Abbreviated).unwrap();
850-
/// let formatter = names.try_into_formatter(YMD::long().time_hm()).unwrap();
850+
/// let formatter = names.try_into_formatter(YMD::long().with_time_hm()).unwrap();
851851
///
852852
/// assert_writeable_eq!(
853853
/// formatter.format(&DateTime {
@@ -1035,7 +1035,7 @@ impl<FSet: DateTimeNamesMarker> DateTimeNames<FSet> {
10351035
/// // This assumes that the locale uses Abbreviated names for the given semantic skeleton!
10361036
/// let mut names = DateTimeNames::from_formatter(prefs, formatter).cast_into_fset::<YMDT>();
10371037
/// names.as_mut().include_day_period_names(DayPeriodNameLength::Abbreviated).unwrap();
1038-
/// let formatter = names.try_into_formatter(YMD::long().time_hm()).unwrap();
1038+
/// let formatter = names.try_into_formatter(YMD::long().with_time_hm()).unwrap();
10391039
///
10401040
/// assert_writeable_eq!(
10411041
/// formatter.format(&DateTime {

components/icu/examples/chrono_jiff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn main() {
4040
// A English, Japanese calendar, medium-length, year-month-day-time-specific-zone formatter
4141
let formatter = DateTimeFormatter::try_new(
4242
locale!("en-GB-u-ca-japanese").into(),
43-
fieldsets::YMDT::medium().zone(fieldsets::zone::SpecificLong),
43+
fieldsets::YMDT::medium().with_zone(fieldsets::zone::SpecificLong),
4444
)
4545
.expect("data is present");
4646

0 commit comments

Comments
 (0)