Struct stm32_eth::ptp::Subseconds
source · pub struct Subseconds(_);
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 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<Subseconds> for Subseconds
impl Add<Subseconds> for Subseconds
§type Output = Subseconds
type Output = Subseconds
The resulting type after applying the
+
operator.source§impl AddAssign<Subseconds> for Subseconds
impl AddAssign<Subseconds> 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 copy 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<Subseconds> for Subseconds
impl PartialEq<Subseconds> for Subseconds
source§fn eq(&self, other: &Subseconds) -> bool
fn eq(&self, other: &Subseconds) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<Subseconds> for Subseconds
impl PartialOrd<Subseconds> for Subseconds
source§fn partial_cmp(&self, other: &Subseconds) -> Option<Ordering>
fn partial_cmp(&self, other: &Subseconds) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Sub<Subseconds> for Subseconds
impl Sub<Subseconds> for Subseconds
§type Output = Subseconds
type Output = Subseconds
The resulting type after applying the
-
operator.source§impl SubAssign<Subseconds> for Subseconds
impl SubAssign<Subseconds> for Subseconds
source§fn sub_assign(&mut self, rhs: Subseconds)
fn sub_assign(&mut self, rhs: Subseconds)
Performs the
-=
operation. Read more