pub struct Subseconds(/* private fields */);
Expand description
A subsecond value as produced by the PTP peripheral
Implementations§
Source§impl Subseconds
impl Subseconds
Sourcepub const MAX_VALUE: u32 = 2_147_483_647u32
pub const MAX_VALUE: u32 = 2_147_483_647u32
The maximum possible value for Subseconds
Sourcepub const MAX: Self
pub const MAX: Self
The maximum possible Subseconds
Sourcepub const ZERO: Self
pub const ZERO: Self
Zero Subseconds
Sourcepub const fn new(value: u32) -> Option<Self>
pub const fn new(value: u32) -> Option<Self>
Create a new Subseconds
from the provided value.
The returned Subseconds
represents a time of value / 2^31
seconds.
To obtain that representation in nanoseconds, see Subseconds::nanos
.
To approximate a Subseconds
from nanoseconds, see Subseconds::new_from_nanos
.
Returns None
if value > SUBSECONDS_PER_SECOND
. (See SUBSECONDS_PER_SECOND
).
Sourcepub const fn new_from_nanos(nanos: u32) -> Option<Self>
pub const fn new_from_nanos(nanos: u32) -> Option<Self>
Create a new Subseconds
from the given amount of nanoseconds,
using a round-to-nearest method.
Returns None
if nanos >= NANOS_PER_SECOND
. (See NANOS_PER_SECOND
)
Sourcepub const fn nanos(&self) -> u32
pub const fn nanos(&self) -> u32
Convert this Subseconds
to nanoseconds, using a round-to-nearest method.
Sourcepub const fn raw(&self) -> u32
pub const fn raw(&self) -> u32
Get the raw value of this Subseconds
Trait Implementations§
Source§impl Add for Subseconds
impl Add for Subseconds
Source§type Output = Subseconds
type Output = Subseconds
The resulting type after applying the
+
operator.Source§impl AddAssign for Subseconds
impl AddAssign for Subseconds
Source§fn add_assign(&mut self, rhs: Subseconds)
fn add_assign(&mut self, rhs: Subseconds)
Performs the
+=
operation. Read moreSource§impl Clone for Subseconds
impl Clone for Subseconds
Source§fn clone(&self) -> Subseconds
fn clone(&self) -> Subseconds
Returns a duplicate of the value. Read more
1.0.0 · 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 Subseconds
impl Debug for Subseconds
Source§impl Format for Subseconds
impl Format for Subseconds
Source§impl Ord for Subseconds
impl Ord for Subseconds
Source§fn cmp(&self, other: &Subseconds) -> Ordering
fn cmp(&self, other: &Subseconds) -> Ordering
1.21.0 · 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 PartialEq for Subseconds
impl PartialEq for Subseconds
Source§impl PartialOrd for Subseconds
impl PartialOrd for Subseconds
Source§impl Sub for Subseconds
impl Sub for Subseconds
Source§type Output = Subseconds
type Output = Subseconds
The resulting type after applying the
-
operator.Source§impl SubAssign for Subseconds
impl SubAssign for Subseconds
Source§fn sub_assign(&mut self, rhs: Subseconds)
fn sub_assign(&mut self, rhs: Subseconds)
Performs the
-=
operation. Read moreimpl Copy for Subseconds
impl Eq for Subseconds
impl StructuralPartialEq for Subseconds
Auto Trait Implementations§
impl Freeze for Subseconds
impl RefUnwindSafe for Subseconds
impl Send for Subseconds
impl Sync for Subseconds
impl Unpin for Subseconds
impl UnwindSafe for Subseconds
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