Struct temporal_rs::components::duration::DateDuration
source · #[non_exhaustive]pub struct DateDuration {
pub years: f64,
pub months: f64,
pub weeks: f64,
pub days: f64,
}
Expand description
DateDuration
represents the date duration record of the Duration.
These fields are laid out in the Temporal Proposal as 64-bit floating point numbers.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.years: f64
DateDuration
’s internal year value.
months: f64
DateDuration
’s internal month value.
weeks: f64
DateDuration
’s internal week value.
days: f64
DateDuration
’s internal day value.
Implementations§
source§impl DateDuration
impl DateDuration
sourcepub fn balance_relative<C: CalendarProtocol>(
&self,
largest_unit: TemporalUnit,
smallest_unit: TemporalUnit,
plain_relative_to: Option<&Date<C>>,
context: &mut C::Context
) -> TemporalResult<DateDuration>
pub fn balance_relative<C: CalendarProtocol>( &self, largest_unit: TemporalUnit, smallest_unit: TemporalUnit, plain_relative_to: Option<&Date<C>>, context: &mut C::Context ) -> TemporalResult<DateDuration>
7.5.38 BalanceDateDurationRelative ( years, months, weeks, days, largestUnit, smallestUnit, plainRelativeTo, calendarRec )
source§impl DateDuration
impl DateDuration
sourcepub fn new(
years: f64,
months: f64,
weeks: f64,
days: f64
) -> TemporalResult<Self>
pub fn new( years: f64, months: f64, weeks: f64, days: f64 ) -> TemporalResult<Self>
Creates a new DateDuration
with provided values.
sourcepub fn from_partial(partial: &DateDuration) -> Self
pub fn from_partial(partial: &DateDuration) -> Self
Creates a DateDuration
from a provided partial DateDuration
.
source§impl DateDuration
impl DateDuration
sourcepub fn round<C: CalendarProtocol, Z: TzProtocol>(
&self,
normalized_time: Option<NormalizedTimeDuration>,
increment: u64,
unit: TemporalUnit,
rounding_mode: TemporalRoundingMode,
relative_to: &RelativeTo<'_, C, Z>,
_precalculated_dt: Option<DateTime<C>>,
context: &mut C::Context
) -> TemporalResult<(Self, f64)>
pub fn round<C: CalendarProtocol, Z: TzProtocol>( &self, normalized_time: Option<NormalizedTimeDuration>, increment: u64, unit: TemporalUnit, rounding_mode: TemporalRoundingMode, relative_to: &RelativeTo<'_, C, Z>, _precalculated_dt: Option<DateTime<C>>, context: &mut C::Context ) -> TemporalResult<(Self, f64)>
Rounds the current DateDuration
returning a tuple of the rounded DateDuration
and
the total
value of the smallest unit prior to rounding.
Trait Implementations§
source§impl Clone for DateDuration
impl Clone for DateDuration
source§fn clone(&self) -> DateDuration
fn clone(&self) -> DateDuration
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for DateDuration
impl Debug for DateDuration
source§impl Default for DateDuration
impl Default for DateDuration
source§fn default() -> DateDuration
fn default() -> DateDuration
Returns the “default value” for a type. Read more
impl Copy for DateDuration
Auto Trait Implementations§
impl RefUnwindSafe for DateDuration
impl Send for DateDuration
impl Sync for DateDuration
impl Unpin for DateDuration
impl UnwindSafe for DateDuration
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more