Skip to main content

Duration

Struct Duration 

Source
pub struct Duration(/* private fields */);

Implementations§

Source§

impl Duration

Source

pub fn create( years: i64, months: i64, weeks: i64, days: i64, hours: i64, minutes: i64, seconds: i64, milliseconds: i64, microseconds: f64, nanoseconds: f64, ) -> Result<Box<Self>, TemporalError>

Temporary API until v8 can move off of it

Source

pub fn try_new( years: i64, months: i64, weeks: i64, days: i64, hours: i64, minutes: i64, seconds: i64, milliseconds: i64, microseconds: f64, nanoseconds: f64, ) -> Result<Box<Self>, TemporalError>

Source

pub fn from_partial_duration( partial: PartialDuration, ) -> Result<Box<Self>, TemporalError>

Source

pub fn from_utf8(s: &DiplomatStr) -> Result<Box<Self>, TemporalError>

Source

pub fn from_utf16(s: &DiplomatStr16) -> Result<Box<Self>, TemporalError>

Source

pub fn is_time_within_range(&self) -> bool

Source

pub fn years(&self) -> i64

Source

pub fn months(&self) -> i64

Source

pub fn weeks(&self) -> i64

Source

pub fn days(&self) -> i64

Source

pub fn hours(&self) -> i64

Source

pub fn minutes(&self) -> i64

Source

pub fn seconds(&self) -> i64

Source

pub fn milliseconds(&self) -> i64

Source

pub fn microseconds(&self) -> f64

Source

pub fn nanoseconds(&self) -> f64

Source

pub fn sign(&self) -> Sign

Source

pub fn is_zero(&self) -> bool

Source

pub fn abs(&self) -> Box<Self>

Source

pub fn negated(&self) -> Box<Self>

Source

pub fn add(&self, other: &Self) -> Result<Box<Self>, TemporalError>

Source

pub fn subtract(&self, other: &Self) -> Result<Box<Self>, TemporalError>

Source

pub fn to_string( &self, options: ToStringRoundingOptions, write: &mut DiplomatWrite, ) -> Result<(), TemporalError>

Source

pub fn round( &self, options: RoundingOptions, relative_to: RelativeTo<'_>, ) -> Result<Box<Self>, TemporalError>

Source

pub fn round_with_provider<'p>( &self, options: RoundingOptions, relative_to: RelativeTo<'_>, p: &Provider<'p>, ) -> Result<Box<Self>, TemporalError>

Source

pub fn compare( &self, other: &Self, relative_to: RelativeTo<'_>, ) -> Result<i8, TemporalError>

Source

pub fn compare_with_provider<'p>( &self, other: &Self, relative_to: RelativeTo<'_>, p: &Provider<'p>, ) -> Result<i8, TemporalError>

Source

pub fn total( &self, unit: Unit, relative_to: RelativeTo<'_>, ) -> Result<f64, TemporalError>

Source

pub fn total_with_provider<'p>( &self, unit: Unit, relative_to: RelativeTo<'_>, p: &Provider<'p>, ) -> Result<f64, TemporalError>

Source

pub fn clone(&self) -> Box<Self>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,