[−][src]Struct asm_delay::Milliseconds
A duration unit type
Trait Implementations
impl<Rep, RhsDur> Add<RhsDur> for Milliseconds<Rep> where
Rep: TimeInt + TryFrom<<RhsDur as Duration>::Rep>,
RhsDur: Duration,
<RhsDur as Duration>::Rep: TimeInt, [src]
Rep: TimeInt + TryFrom<<RhsDur as Duration>::Rep>,
RhsDur: Duration,
<RhsDur as Duration>::Rep: TimeInt,
type Output = Milliseconds<Rep>
The resulting type after applying the + operator.
fn add(self, rhs: RhsDur) -> <Milliseconds<Rep> as Add<RhsDur>>::Output[src]
See module-level documentation for details about this type
impl<T> Clone for Milliseconds<T> where
T: TimeInt + Clone, [src]
T: TimeInt + Clone,
fn clone(&self) -> Milliseconds<T>[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<T> Copy for Milliseconds<T> where
T: TimeInt + Copy, [src]
T: TimeInt + Copy,
impl<T> Debug for Milliseconds<T> where
T: TimeInt + Debug, [src]
T: TimeInt + Debug,
impl<T> Display for Milliseconds<T> where
T: TimeInt, [src]
T: TimeInt,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>[src]
See module-level documentation for details about this type
impl<Rep> Duration for Milliseconds<Rep> where
Rep: TimeInt, [src]
Rep: TimeInt,
type Rep = Rep
The inner type of the Duration representing the count of the implementation unit
const PERIOD: Period<u32>[src]
fn new(value: <Milliseconds<Rep> as Duration>::Rep) -> Milliseconds<Rep>[src]
fn count(self) -> <Milliseconds<Rep> as Duration>::Rep[src]
fn from_ticks<Rep>(ticks: Rep, period: Period<u32>) -> Option<Self> where
Rep: TimeInt,
Self::Rep: TryFrom<Rep>, [src]
Rep: TimeInt,
Self::Rep: TryFrom<Rep>,
fn into_ticks<Rep>(self, period: Period<u32>) -> Option<Rep> where
Rep: TimeInt + TryFrom<Self::Rep>,
Self::Rep: TimeInt, [src]
Rep: TimeInt + TryFrom<Self::Rep>,
Self::Rep: TimeInt,
#[must_use]fn min_value() -> Self::Rep[src]
#[must_use]fn max_value() -> Self::Rep[src]
impl<T> Eq for Milliseconds<T> where
T: TimeInt + Eq, [src]
T: TimeInt + Eq,
impl<T> Ord for Milliseconds<T> where
T: TimeInt + Ord, [src]
T: TimeInt + Ord,
fn cmp(&self, other: &Milliseconds<T>) -> Ordering[src]
#[must_use]fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self[src]
impl<Rep, OtherDur> PartialEq<OtherDur> for Milliseconds<Rep> where
OtherDur: Duration,
Rep: TimeInt + TryFrom<<OtherDur as Duration>::Rep>,
<OtherDur as Duration>::Rep: TryFrom<Rep>, [src]
OtherDur: Duration,
Rep: TimeInt + TryFrom<<OtherDur as Duration>::Rep>,
<OtherDur as Duration>::Rep: TryFrom<Rep>,
fn eq(&self, other: &OtherDur) -> bool[src]
See module-level documentation for details about this type
#[must_use]fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl<Rep, OtherDur> PartialOrd<OtherDur> for Milliseconds<Rep> where
OtherDur: Duration,
Rep: TimeInt + TryFrom<<OtherDur as Duration>::Rep>,
<OtherDur as Duration>::Rep: TryFrom<Rep>, [src]
OtherDur: Duration,
Rep: TimeInt + TryFrom<<OtherDur as Duration>::Rep>,
<OtherDur as Duration>::Rep: TryFrom<Rep>,
fn partial_cmp(&self, other: &OtherDur) -> Option<Ordering>[src]
See module-level documentation for details about this type
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<Rep, Dur> Rem<Dur> for Milliseconds<Rep> where
Dur: Duration,
Rep: TimeInt + TryFrom<<Dur as Duration>::Rep>, [src]
Dur: Duration,
Rep: TimeInt + TryFrom<<Dur as Duration>::Rep>,
type Output = Milliseconds<Rep>
The resulting type after applying the % operator.
fn rem(self, rhs: Dur) -> <Milliseconds<Rep> as Rem<Dur>>::Output[src]
impl<T> StructuralEq for Milliseconds<T> where
T: TimeInt, [src]
T: TimeInt,
impl<Rep, RhsDur> Sub<RhsDur> for Milliseconds<Rep> where
Rep: TimeInt + TryFrom<<RhsDur as Duration>::Rep>,
RhsDur: Duration, [src]
Rep: TimeInt + TryFrom<<RhsDur as Duration>::Rep>,
RhsDur: Duration,
type Output = Milliseconds<Rep>
The resulting type after applying the - operator.
fn sub(self, rhs: RhsDur) -> <Milliseconds<Rep> as Sub<RhsDur>>::Output[src]
See module-level documentation for details about this type
impl<Rep> TryFrom<Duration> for Milliseconds<Rep> where
Rep: TimeInt, [src]
Rep: TimeInt,
type Error = <Rep as TryFrom<u128>>::Error
The type returned in the event of a conversion error.
fn try_from(
core_duration: Duration
) -> Result<Milliseconds<Rep>, <Milliseconds<Rep> as TryFrom<Duration>>::Error>[src]
core_duration: Duration
) -> Result<Milliseconds<Rep>, <Milliseconds<Rep> as TryFrom<Duration>>::Error>
Convert a core::time::Duration into an embedded_time::[Duration]
Auto Trait Implementations
impl<T> Send for Milliseconds<T> where
T: Send,
T: Send,
impl<T> Sync for Milliseconds<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Milliseconds<T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<Source, Dest> TryConvertFrom<Source> for Dest where
Dest: Duration,
Source: Duration,
<Dest as Duration>::Rep: TryFrom<<Source as Duration>::Rep>, [src]
Dest: Duration,
Source: Duration,
<Dest as Duration>::Rep: TryFrom<<Source as Duration>::Rep>,
fn try_convert_from(source: Source) -> Option<Dest>[src]
Attempt to convert from one duration type to another
Both the underlying storage type and/or the LSbit period can be converted
Examples
assert_eq!(Seconds::<u32>::try_convert_from(Milliseconds(23_000_u64)), Some(Seconds(23_u32))); assert_eq!(Seconds::<u64>::try_convert_from(Milliseconds(23_000_u32)), Some(Seconds(23_u64))); assert_eq!(Seconds::<u32>::try_convert_from(Milliseconds(230_u32)), Some(Seconds(0)));
Errors
the conversion of periods causes an overflow:
assert_eq!(Milliseconds::<u32>::try_convert_from(Seconds(u32::MAX)), None);
the Self integer cast to that of the provided type fails
assert_eq!(Seconds::<u32>::try_convert_from(Seconds(u32::MAX as u64 + 1)), None);
However, these work because the sequence of cast/conversion adapts
// period conversion applied first assert_eq!(Hours::<u32>::try_convert_from(Microseconds(3_600_000_000_u64)), Some(Hours(1_u32))); // cast applied first assert_eq!(Microseconds::<u64>::try_convert_from(Hours(1_u32)), Some(Microseconds(3_600_000_000_u64)));
Returns
None if the result of the conversion does not fit in the requested integer size
impl<Source, Dest> TryConvertInto<Dest> for Source where
Dest: Duration + TryConvertFrom<Source>,
Source: Duration, [src]
Dest: Duration + TryConvertFrom<Source>,
Source: Duration,
fn try_convert_into(self) -> Option<Dest>[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,