pub struct RationalTime { /* private fields */ }Expand description
An exact integer value measured at a rational rate.
Implementations§
Source§impl RationalTime
impl RationalTime
Sourcepub const fn new(value: i64, rate: RationalRate) -> Self
pub const fn new(value: i64, rate: RationalRate) -> Self
Creates a rational time value.
Sourcepub const fn rate(self) -> RationalRate
pub const fn rate(self) -> RationalRate
Returns the rate used to interpret the value.
Sourcepub fn checked_cmp(self, other: Self) -> Result<Ordering>
pub fn checked_cmp(self, other: Self) -> Result<Ordering>
Compares two time values exactly without floating-point conversion.
§Errors
Returns ErrorKind::InvalidArgument if checked cross multiplication
exceeds the internal comparison range.
Sourcepub fn equivalent(self, other: Self) -> Result<bool>
pub fn equivalent(self, other: Self) -> Result<bool>
Returns whether two values denote the same exact time.
§Errors
Returns an error under the same conditions as Self::checked_cmp.
Sourcepub fn rescaled_to(self, rate: RationalRate) -> Result<Self>
pub fn rescaled_to(self, rate: RationalRate) -> Result<Self>
Converts this value to rate when the result is an exact integer.
§Errors
Returns ErrorKind::InvalidArgument if the target rate cannot
represent the time exactly or the converted value exceeds i64.
Trait Implementations§
Source§impl Clone for RationalTime
impl Clone for RationalTime
Source§fn clone(&self) -> RationalTime
fn clone(&self) -> RationalTime
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RationalTime
Source§impl Debug for RationalTime
impl Debug for RationalTime
Source§impl Display for RationalTime
impl Display for RationalTime
impl Eq for RationalTime
Source§impl FromStr for RationalTime
impl FromStr for RationalTime
Source§impl Hash for RationalTime
impl Hash for RationalTime
Source§impl PartialEq for RationalTime
impl PartialEq for RationalTime
Source§fn eq(&self, other: &RationalTime) -> bool
fn eq(&self, other: &RationalTime) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RationalTime
Auto Trait Implementations§
impl Freeze for RationalTime
impl RefUnwindSafe for RationalTime
impl Send for RationalTime
impl Sync for RationalTime
impl Unpin for RationalTime
impl UnsafeUnpin for RationalTime
impl UnwindSafe for RationalTime
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