pub struct PendingDuration(/* private fields */);Expand description
A wrapper for floating-point representations of Duration to mitigate rounding errors.
Implementations§
Source§impl PendingDuration
impl PendingDuration
Sourcepub fn from_duration(duration: Duration) -> Self
pub fn from_duration(duration: Duration) -> Self
Creates a new PendingDuration from a Duration.
Sourcepub fn try_to_duration(&self) -> Option<Duration>
pub fn try_to_duration(&self) -> Option<Duration>
Attempts to convert this instance into a Duration.
Returns None if the value is negative.
Sourcepub fn to_duration(&self) -> Duration
pub fn to_duration(&self) -> Duration
Sourcepub fn to_duration_with_clamp(&self, max: TimeTick) -> Duration
pub fn to_duration_with_clamp(&self, max: TimeTick) -> Duration
Converts to a Duration, clamping the result between 0 and max ticks.
Sourcepub fn to_duration_or_else<F>(&self, f: F) -> Duration
pub fn to_duration_or_else<F>(&self, f: F) -> Duration
Converts to a Duration, invoking the provided closure if the conversion fails.
Trait Implementations§
Source§impl Add<Duration> for PendingDuration
impl Add<Duration> for PendingDuration
Source§impl Add for PendingDuration
impl Add for PendingDuration
Source§type Output = PendingDuration
type Output = PendingDuration
The resulting type after applying the
+ operator.Source§impl Clone for PendingDuration
impl Clone for PendingDuration
Source§fn clone(&self) -> PendingDuration
fn clone(&self) -> PendingDuration
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 moreSource§impl Debug for PendingDuration
impl Debug for PendingDuration
Source§impl From<Duration> for PendingDuration
impl From<Duration> for PendingDuration
Source§impl PartialEq for PendingDuration
impl PartialEq for PendingDuration
Source§fn eq(&self, other: &PendingDuration) -> bool
fn eq(&self, other: &PendingDuration) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for PendingDuration
impl PartialOrd for PendingDuration
Source§impl Sub<Duration> for PendingDuration
impl Sub<Duration> for PendingDuration
Source§impl Sub for PendingDuration
impl Sub for PendingDuration
Source§type Output = PendingDuration
type Output = PendingDuration
The resulting type after applying the
- operator.impl Copy for PendingDuration
impl StructuralPartialEq for PendingDuration
Auto Trait Implementations§
impl Freeze for PendingDuration
impl RefUnwindSafe for PendingDuration
impl Send for PendingDuration
impl Sync for PendingDuration
impl Unpin for PendingDuration
impl UnsafeUnpin for PendingDuration
impl UnwindSafe for PendingDuration
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more