Re-add erroneously removed newlines
This commit is contained in:
parent
dcdd768e03
commit
f8d63279ef
@ -37,6 +37,7 @@ impl Duration {
|
|||||||
ticks: secs * TICKS_PER_SECOND,
|
ticks: secs * TICKS_PER_SECOND,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a duration from the specified number of milliseconds
|
/// Creates a duration from the specified number of milliseconds
|
||||||
pub const fn from_millis(millis: u64) -> Duration {
|
pub const fn from_millis(millis: u64) -> Duration {
|
||||||
Duration {
|
Duration {
|
||||||
@ -61,19 +62,21 @@ impl Duration {
|
|||||||
.checked_add(rhs.ticks)
|
.checked_add(rhs.ticks)
|
||||||
.map(|ticks| Duration { ticks })
|
.map(|ticks| Duration { ticks })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Subtracts one Duration to another, returning a new Duration or None in the event of an overflow.
|
/// Subtracts one Duration to another, returning a new Duration or None in the event of an overflow.
|
||||||
pub fn checked_sub(self, rhs: Duration) -> Option<Duration> {
|
pub fn checked_sub(self, rhs: Duration) -> Option<Duration> {
|
||||||
self.ticks
|
self.ticks
|
||||||
.checked_sub(rhs.ticks)
|
.checked_sub(rhs.ticks)
|
||||||
.map(|ticks| Duration { ticks })
|
.map(|ticks| Duration { ticks })
|
||||||
}
|
}
|
||||||
/// Multiplies one Duration to another, returning a new Duration or None in the event of an overflow.
|
|
||||||
|
|
||||||
|
/// Multiplies one Duration to another, returning a new Duration or None in the event of an overflow.
|
||||||
pub fn checked_mul(self, rhs: u32) -> Option<Duration> {
|
pub fn checked_mul(self, rhs: u32) -> Option<Duration> {
|
||||||
self.ticks
|
self.ticks
|
||||||
.checked_mul(rhs as _)
|
.checked_mul(rhs as _)
|
||||||
.map(|ticks| Duration { ticks })
|
.map(|ticks| Duration { ticks })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Divides one Duration against another, returning a new Duration or None in the event of an overflow.
|
/// Divides one Duration against another, returning a new Duration or None in the event of an overflow.
|
||||||
pub fn checked_div(self, rhs: u32) -> Option<Duration> {
|
pub fn checked_div(self, rhs: u32) -> Option<Duration> {
|
||||||
self.ticks
|
self.ticks
|
||||||
|
@ -31,6 +31,7 @@ impl Instant {
|
|||||||
ticks: millis * TICKS_PER_SECOND as u64 / 1000,
|
ticks: millis * TICKS_PER_SECOND as u64 / 1000,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Instant representing seconds since MCU start.
|
/// Instant representing seconds since MCU start.
|
||||||
pub const fn from_secs(seconds: u64) -> Self {
|
pub const fn from_secs(seconds: u64) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
Loading…
Reference in New Issue
Block a user