#[repr(transparent)]pub struct Timeval(pub timeval);
Expand description
Wrapper for libc::timeval
, attaching various methods and trait implementations.
Tuple Fields§
§0: timeval
Implementations§
Source§impl Timeval
impl Timeval
Sourcepub const fn new(sec: time_t, usec: suseconds_t) -> Self
pub const fn new(sec: time_t, usec: suseconds_t) -> Self
Creates a new instance, with values provided.
Sourcepub fn diff(a: &Self, b: &Self) -> MicroSeconds
pub fn diff(a: &Self, b: &Self) -> MicroSeconds
Calculates the difference between the two specified timeval structs.
Sourcepub fn age(&self) -> MicroSeconds
pub fn age(&self) -> MicroSeconds
Gets the time difference between now and self.
Sourcepub fn checked_add(self, other: Self) -> Option<Self>
pub fn checked_add(self, other: Self) -> Option<Self>
Checked integer addition. Computes self + rhs
, returning None
if overflow occurred,
using the inner integer’s checked_add()
method.
Sourcepub fn checked_add_us(self, rhs: MicroSeconds) -> Option<Self>
pub fn checked_add_us(self, rhs: MicroSeconds) -> Option<Self>
Checked integer addition. Computes self + rhs
, returning None
if overflow occurred,
using the inner integer’s checked_add()
method.
Sourcepub fn checked_add_duration(self, rhs: Duration) -> Option<Self>
pub fn checked_add_duration(self, rhs: Duration) -> Option<Self>
Checked integer addition. Computes self + rhs
, returning None
if overflow occurred,
using the inner integer’s checked_add()
method.
Sourcepub fn checked_sub(self, other: Self) -> Option<Self>
pub fn checked_sub(self, other: Self) -> Option<Self>
Checked integer subtraction. Computes self - rhs
, returning None
if overflow occurred,
using the inner integer’s checked_sub()
method.
Sourcepub fn checked_sub_us(self, rhs: MicroSeconds) -> Option<Self>
pub fn checked_sub_us(self, rhs: MicroSeconds) -> Option<Self>
Checked integer subtraction. Computes self - rhs
, returning None
if overflow occurred,
using the inner integer’s checked_sub()
method.
Sourcepub fn checked_sub_duration(self, rhs: Duration) -> Option<Self>
pub fn checked_sub_duration(self, rhs: Duration) -> Option<Self>
Checked integer subtraction. Computes self - rhs
, returning None
if overflow occurred,
using the inner integer’s checked_sub()
method.
Sourcepub fn checked_mul(self, rhs: u32) -> Option<Self>
pub fn checked_mul(self, rhs: u32) -> Option<Self>
Checked integer multiplication. Computes self * rhs
, returning None
if overflow
occurred, using the inner integer’s checked_mul()
method.
Sourcepub fn checked_div(self, rhs: u32) -> Option<Self>
pub fn checked_div(self, rhs: u32) -> Option<Self>
Checked integer division. Computes self / rhs
, returning None
if rhs == 0
, using the
inner integer’s checked_div()
method.
Sourcepub fn checked_rem(self, rhs: u32) -> Option<Self>
pub fn checked_rem(self, rhs: u32) -> Option<Self>
Checked integer remainder. Computes self % rhs
, returning None
if rhs == 0
, using the
inner integer’s checked_rem()
method.
Trait Implementations§
Source§impl Add<MicroSeconds> for Timeval
impl Add<MicroSeconds> for Timeval
Source§impl AddAssign<Duration> for Timeval
impl AddAssign<Duration> for Timeval
Source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
+=
operation. Read moreSource§impl AddAssign<MicroSeconds> for Timeval
impl AddAssign<MicroSeconds> for Timeval
Source§fn add_assign(&mut self, rhs: MicroSeconds)
fn add_assign(&mut self, rhs: MicroSeconds)
+=
operation. Read moreSource§impl AddAssign for Timeval
impl AddAssign for Timeval
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+=
operation. Read moreSource§impl DivAssign<u32> for Timeval
impl DivAssign<u32> for Timeval
Source§fn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
/=
operation. Read moreSource§impl From<MicroSeconds> for Timeval
impl From<MicroSeconds> for Timeval
Source§fn from(t: MicroSeconds) -> Self
fn from(t: MicroSeconds) -> Self
Source§impl From<Timeval> for MicroSeconds
impl From<Timeval> for MicroSeconds
Source§impl MulAssign<u32> for Timeval
impl MulAssign<u32> for Timeval
Source§fn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
*=
operation. Read moreSource§impl Ord for Timeval
impl Ord for Timeval
Source§impl PartialOrd for Timeval
impl PartialOrd for Timeval
Source§impl RemAssign<u32> for Timeval
impl RemAssign<u32> for Timeval
Source§fn rem_assign(&mut self, rhs: u32)
fn rem_assign(&mut self, rhs: u32)
%=
operation. Read moreSource§impl Sub<MicroSeconds> for Timeval
impl Sub<MicroSeconds> for Timeval
Source§impl SubAssign<Duration> for Timeval
impl SubAssign<Duration> for Timeval
Source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
-=
operation. Read moreSource§impl SubAssign<MicroSeconds> for Timeval
impl SubAssign<MicroSeconds> for Timeval
Source§fn sub_assign(&mut self, rhs: MicroSeconds)
fn sub_assign(&mut self, rhs: MicroSeconds)
-=
operation. Read moreSource§impl SubAssign for Timeval
impl SubAssign for Timeval
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-=
operation. Read more