Skip to content

Commit e28b788

Browse files
authored
Make TimeZone no longer allocate over FFI (#572)
This also moves a lot of internal stuff to taking TimeZone instead of &TimeZone. I think that's fine but I can revert if requested.
1 parent 5a5cd3b commit e28b788

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+360
-339
lines changed

src/builtins/compiled/instant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ impl Instant {
1111
/// Enable with the `compiled_data` feature flag.
1212
pub fn to_ixdtf_string(
1313
&self,
14-
timezone: Option<&TimeZone>,
14+
timezone: Option<TimeZone>,
1515
options: ToStringRoundingOptions,
1616
) -> TemporalResult<String> {
1717
self.to_ixdtf_string_with_provider(timezone, options, &*TZ_PROVIDER)
@@ -23,7 +23,7 @@ impl Instant {
2323
/// Enable with the `compiled_data` feature flag.
2424
pub fn to_ixdtf_writeable(
2525
&self,
26-
timezone: Option<&TimeZone>,
26+
timezone: Option<TimeZone>,
2727
options: ToStringRoundingOptions,
2828
) -> TemporalResult<impl writeable::Writeable + '_> {
2929
self.to_ixdtf_writeable_with_provider(timezone, options, &*TZ_PROVIDER)

src/builtins/compiled/plain_month_day.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::{
33
};
44

55
impl PlainMonthDay {
6-
pub fn epoch_ns_for(&self, time_zone: &TimeZone) -> TemporalResult<EpochNanoseconds> {
6+
pub fn epoch_ns_for(&self, time_zone: TimeZone) -> TemporalResult<EpochNanoseconds> {
77
self.epoch_ns_for_with_provider(time_zone, &*TZ_PROVIDER)
88
}
99
}

src/builtins/compiled/plain_year_month.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::{
33
};
44

55
impl PlainYearMonth {
6-
pub fn epoch_ns_for(&self, time_zone: &TimeZone) -> TemporalResult<EpochNanoseconds> {
6+
pub fn epoch_ns_for(&self, time_zone: TimeZone) -> TemporalResult<EpochNanoseconds> {
77
self.epoch_ns_for_with_provider(time_zone, &*TZ_PROVIDER)
88
}
99
}

src/builtins/core/instant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ impl Instant {
402402
impl Instant {
403403
pub fn to_ixdtf_string_with_provider(
404404
&self,
405-
timezone: Option<&TimeZone>,
405+
timezone: Option<TimeZone>,
406406
options: ToStringRoundingOptions,
407407
provider: &impl TimeZoneProvider,
408408
) -> TemporalResult<String> {
@@ -412,7 +412,7 @@ impl Instant {
412412

413413
pub fn to_ixdtf_writeable_with_provider(
414414
&self,
415-
timezone: Option<&TimeZone>,
415+
timezone: Option<TimeZone>,
416416
options: ToStringRoundingOptions,
417417
provider: &impl TimeZoneProvider,
418418
) -> TemporalResult<impl Writeable + '_> {

src/builtins/core/plain_month_day.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ impl PlainMonthDay {
352352
// Useful for implementing HandleDateTimeTemporalYearMonth
353353
pub fn epoch_ns_for_with_provider(
354354
&self,
355-
time_zone: &TimeZone,
355+
time_zone: TimeZone,
356356
provider: &impl TimeZoneProvider,
357357
) -> TemporalResult<EpochNanoseconds> {
358358
// 2. Let isoDateTime be CombineISODateAndTimeRecord(temporalYearMonth.[[ISODate]], NoonTimeRecord()).

src/builtins/core/plain_year_month.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ impl PlainYearMonth {
614614
// Useful for implementing HandleDateTimeTemporalYearMonth
615615
pub fn epoch_ns_for_with_provider(
616616
&self,
617-
time_zone: &TimeZone,
617+
time_zone: TimeZone,
618618
provider: &impl TimeZoneProvider,
619619
) -> TemporalResult<EpochNanoseconds> {
620620
// 2. Let isoDateTime be CombineISODateAndTimeRecord(temporalYearMonth.[[ISODate]], NoonTimeRecord()).

temporal_capi/bindings/c/Instant.h

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

temporal_capi/bindings/c/PartialZonedDateTime.d.h

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

temporal_capi/bindings/c/PlainDate.h

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

temporal_capi/bindings/c/PlainDateTime.h

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)