Upgrading time 0.2 to 0.3
Breaking0.2.27 → 0.3.55Breaking53Security1Platform1New88Changed24Fixed6Other2
BreakingUpgrade verdict
53 breaking changes and a platform requirement change and a security fix.
In plain terms
- Renames OffsetDatetime::timestamp to OffsetDateTime::unix_timestamp.
- Renames OffsetDatetime::timestamp_nanos to OffsetDateTime::unix_timestamp_nanos.
- Renames Date::try_from_ymd to Date::from_calendar_date.
- Renames Date::try_from_yo to Date::from_ordinal_date.
Must act Top 5 of 55 that need code or config changes
Requires Rust 1.88.0 from 0.3.46 (none stated before).
What you must change
Breaking53
Renames OffsetDatetime::timestamp to OffsetDateTime::unix_timestamp.
OffsetDatetime::timestampOffsetDateTime::unix_timestampRenames OffsetDatetime::timestamp_nanos to OffsetDateTime::unix_timestamp_nanos.
OffsetDatetime::timestamp_nanosOffsetDateTime::unix_timestamp_nanosRenames Date::try_from_ymd to Date::from_calendar_date.
Date::try_from_ymdDate::from_calendar_dateRenames Date::try_from_yo to Date::from_ordinal_date.
Date::try_from_yoDate::from_ordinal_dateRenames Date::try_from_iso_ywd to Date::from_iso_week_date.
Date::try_from_iso_ywdDate::from_iso_week_dateRenames Date::as_ymd to Date::to_calendar_date.
Date::as_ymdDate::to_calendar_dateRenames Date::as_yo to Date::to_ordinal_date.
Date::as_yoDate::to_ordinal_dateRenames Date::try_with_hms to Date::with_hms.
Date::try_with_hmsDate::with_hmsRenames Date::try_with_hms_milli to Date::with_hms_milli.
Date::try_with_hms_milliDate::with_hms_milliRenames Date::try_with_hms_micro to Date::with_hms_micro.
Date::try_with_hms_microDate::with_hms_microRenames Date::try_with_hms_nano to Date::with_hms_nano.
Date::try_with_hms_nanoDate::with_hms_nanoRenames Time::try_from_hms to Time::from_hms.
Time::try_from_hmsTime::from_hmsRenames Time::try_from_hms_milli to Time::from_hms_milli.
Time::try_from_hms_milliTime::from_hms_milliRenames Time::try_from_hms_micro to Time::from_hms_micro.
Time::try_from_hms_microTime::from_hms_microRenames Time::try_from_hms_nano to Time::from_hms_nano.
Time::try_from_hms_nanoTime::from_hms_nanoRenames UtcOffset::try_local_offset_at to UtcOffset::local_offset_at.
UtcOffset::try_local_offset_atUtcOffset::local_offset_atRenames UtcOffset::as_seconds to UtcOffset::whole_seconds.
UtcOffset::as_secondsUtcOffset::whole_secondsRenames OffsetDateTime::try_now_local to OffsetDateTime::now_local.
OffsetDateTime::try_now_localOffsetDateTime::now_localRenames Date::week to Date::iso_week.
Date::weekDate::iso_weekRenames PrimitiveDateTime::week to PrimitiveDateTime::iso_week.
PrimitiveDateTime::weekPrimitiveDateTime::iso_weekRenames OffsetDateTime::week to OffsetDateTime::iso_week.
OffsetDateTime::weekOffsetDateTime::iso_weekRenames Date::julian_day to Date::to_julian_day.
Date::julian_dayDate::to_julian_dayChanges the valid year range to ±9999 by default, or ±999,999 with the large-dates feature, which has performance and parsing implications.
large-datesRemoves v0.1 APIs that were previously behind an enabled-by-default feature flag.
PreciseTimeSteadyTimeprecise_time_nsprecise_time_sInstant::toDuration::num_weeksDuration::from_stdDuration::to_stdRemoves panicking APIs that were previously behind a non-default feature flag.
Date::from_ymdDate::from_yoDate::from_iso_ywdDate::with_hmsTime::from_hmsTime::from_hms_milliTime::from_hms_microTime::from_hms_nanoRemoves APIs that assumed an offset of UTC, previously enabled unconditionally.
Date::todayTime::nowPrimitiveDateTime::nowPrimitiveDateTime::unix_epochPrimitiveDateTime::from_unix_timestampOffsetDateTime::nowUtcOffset::local_offset_atOffsetDateTime::now_localRemoves other APIs deprecated during 0.2, previously enabled unconditionally.
Duration::signPrimitiveDateTime::using_offsetSignRemoves re-exports of APIs moved during the course of 0.2.
days_in_yearis_leap_yearvalidate_format_stringweeks_in_yearComponentRangeErrorConversionRangeErrorIndeterminateOffsetErrorParseErrorRemoves lazy formatting methods from Time, Date, UtcOffset, PrimitiveDateTime and OffsetDateTime.
Time::lazy_formatDate::lazy_formatUtcOffset::lazy_formatPrimitiveDateTime::lazy_formatOffsetDateTime::lazy_formatRemoves support for stdweb, as the crate is unmaintained.
stdwebRemoves the prelude module in its entirety.
preludeRemoves Date::iso_year_week in favor of Date::to_iso_week_date.
Date::iso_year_weekDate::to_iso_week_dateRemoves PrimitiveDateTime::iso_year_week.
PrimitiveDateTime::iso_year_weekRemoves OffsetDateTime::iso_year_week.
OffsetDateTime::iso_year_weekRemoves UtcOffset::east_hours.
UtcOffset::east_hoursRemoves UtcOffset::west_hours.
UtcOffset::west_hoursRemoves
UtcOffset::hours, east_minutes, west_minutes, minutes, east_seconds, west_seconds, and seconds.UtcOffset::hoursUtcOffset::east_minutesUtcOffset::west_minutesUtcOffset::minutesUtcOffset::east_secondsUtcOffset::west_secondsUtcOffset::secondsRemoves
Date::month_day, PrimitiveDateTime::month_day, and OffsetDateTime::month_day.Date::month_dayPrimitiveDateTime::month_dayOffsetDateTime::month_dayRemoves
Weekday::iso_weekday_number, which was identical to Weekday::number_from_monday.Weekday::iso_weekday_numberWeekday::number_from_mondayRemoves the
ext::NumericalStdDurationShort extension trait.ext::NumericalStdDurationShortPlaces macros behind the macros feature flag.
macrosMakes all Duration unit values, minimum and maximum associated constants.
DurationReplaces OffsetDateTime::unix_epoch() with the OffsetDateTime::UNIX_EPOCH constant.
OffsetDateTime::unix_epoch()OffsetDateTime::UNIX_EPOCHReplaces Time::midnight() with the Time::MIDNIGHT constant.
Time::midnight()Time::MIDNIGHTMakes Date::from_julian_day return a Result.
Date::from_julian_dayMakes OffsetDateTime::from_unix_timestamp return a Result.
OffsetDateTime::from_unix_timestampMakes OffsetDateTime::from_unix_timestamp_nanos return a Result.
OffsetDateTime::from_unix_timestamp_nanosMakes Date::next_day return an Option.
Date::next_dayMakes Date::previous_day return an Option.
Date::previous_dayGates UtcOffset::local_offset_at and OffsetDateTime::now_local behind the local-offset feature.
UtcOffset::local_offset_atOffsetDateTime::now_locallocal-offsetChanges Date::to_julian_day to return i32 instead of i64.
Date::to_julian_dayChanges Date::from_julian_day to accept i32 instead of i64.
Date::from_julian_daySeals extension traits and implements them only for some types.
Security1
Denial of Service via Stack Exhaustion
Platform1
Raises the minimum supported Rust version to 1.48.0, which may be bumped within the 0.3 series.