pub struct Duration {
pub sec: i32,
pub nanosec: u32,
}Expand description
Duration_t — a relative time span (can be negative when
sec < 0).
Fields§
§sec: i32Seconds.
nanosec: u32Nanoseconds-Anteil [0, 999_999_999].
Implementations§
Source§impl Duration
impl Duration
Sourcepub const fn is_infinite(&self) -> bool
pub const fn is_infinite(&self) -> bool
true if the value is Self::INFINITE.
Sourcepub const fn is_zero(&self) -> bool
pub const fn is_zero(&self) -> bool
true if the value is Self::ZERO.
Sourcepub fn to_core(self) -> Duration
pub fn to_core(self) -> Duration
Conversion into core::time::Duration. INFINITE maps to
Duration::MAX; negative seconds map to ZERO
(core::time::Duration is unsigned).
Sourcepub fn from_core(d: Duration) -> Self
pub fn from_core(d: Duration) -> Self
Conversion from core::time::Duration (lossy, clamps seconds
to i32::MAX).
Sourcepub const fn seconds(&self) -> i32
pub const fn seconds(&self) -> i32
Spec §7.5.6.1 — seconds-Accessor (DDS-PSM-Cxx Duration::seconds()).
Sourcepub const fn nanoseconds(&self) -> u32
pub const fn nanoseconds(&self) -> u32
Spec §7.5.6.1 — nanoseconds-Accessor.
Sourcepub fn add_duration(self, d: Duration) -> Self
pub fn add_duration(self, d: Duration) -> Self
Spec §7.5.6.4 — Duration + Duration (increment).
Sourcepub const fn from_millis(ms: i64) -> Self
pub const fn from_millis(ms: i64) -> Self
Spec §7.5.6.5 — Duration from a millisecond integer.
Trait Implementations§
impl Copy for Duration
impl Eq for Duration
Source§impl Ord for Duration
impl Ord for Duration
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Duration
impl PartialOrd for Duration
impl StructuralPartialEq for Duration
Auto Trait Implementations§
impl Freeze for Duration
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnsafeUnpin for Duration
impl UnwindSafe for Duration
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