[−][src]Struct embedded_time::units::Hertz
A frequency unit type
Convertible to/from Period.
Trait Implementations
impl<T: Debug + TimeInt> Debug for Hertz<T>[src]
impl<T: TimeInt, Rhs: TimeInt> Div<Rhs> for Hertz<T> where
T: From<Rhs>, [src]
T: From<Rhs>,
type Output = Self
The resulting type after applying the / operator.
fn div(self, rhs: Rhs) -> Self::Output[src]
assert_eq!(Hertz(300_u32) / 3_u32, Hertz(100_u32));
impl<T: Eq + TimeInt> Eq for Hertz<T>[src]
impl From<Hertz<u32>> for u32[src]
fn from(hertz: Hertz) -> Self[src]
assert_eq!(u32::from(Hertz(23)), 23_u32); assert_eq!(<u32 as Into<Hertz>>::into(23), Hertz(23_u32));
impl From<u32> for Hertz[src]
fn from(value: u32) -> Self[src]
assert_eq!(Hertz::from(23), Hertz(23_u32)); assert_eq!(<Hertz as Into<u32>>::into(Hertz(23_u32)), 23_u32);
impl<T: TimeInt, Rhs: TimeInt> Mul<Rhs> for Hertz<T> where
T: From<Rhs>, [src]
T: From<Rhs>,
type Output = Self
The resulting type after applying the * operator.
fn mul(self, rhs: Rhs) -> Self::Output[src]
assert_eq!(Hertz(100_u32) * 3_u32, Hertz(300_u32));
impl<T: Ord + TimeInt> Ord for Hertz<T>[src]
fn cmp(&self, other: &Hertz<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<T: PartialEq + TimeInt> PartialEq<Hertz<T>> for Hertz<T>[src]
impl<T: PartialOrd + TimeInt> PartialOrd<Hertz<T>> for Hertz<T>[src]
fn partial_cmp(&self, other: &Hertz<T>) -> Option<Ordering>[src]
fn lt(&self, other: &Hertz<T>) -> bool[src]
fn le(&self, other: &Hertz<T>) -> bool[src]
fn gt(&self, other: &Hertz<T>) -> bool[src]
fn ge(&self, other: &Hertz<T>) -> bool[src]
impl<T: TimeInt> StructuralEq for Hertz<T>[src]
impl<T: TimeInt> StructuralPartialEq for Hertz<T>[src]
impl<T: TimeInt> TryFrom<Hertz<T>> for Period<T>[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(freq: Hertz<T>) -> Result<Self, Self::Error>[src]
impl<T: TimeInt> TryFrom<Period<T>> for Hertz<T>[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(period: Period<T>) -> Result<Self, Self::Error>[src]
Create a new Frequency from a fractional Period in seconds
Examples
assert_eq!(Hertz::try_from(<Period>::new(1, 1_000)), Ok(Hertz(1_000_u32))); assert_eq!(Hertz::try_from(<Period>::new(0, 1_000)), Err(ConversionError::DivByZero)); assert_eq!(<Period>::new(1, 1_000).try_into(), Ok(Hertz(1_000_u32)));
Errors
Auto Trait Implementations
impl<T> RefUnwindSafe for Hertz<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Hertz<T> where
T: Send,
T: Send,
impl<T> Sync for Hertz<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Hertz<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Hertz<T> where
T: UnwindSafe,
T: UnwindSafe,
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, 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>,