[−][src]Struct embedded_time::rate::units::BitsPerSecond
Bits/s
Trait Implementations
impl<T: TimeInt, Rhs: Rate> Add<Rhs> for BitsPerSecond<T> where
T: TryFrom<Rhs::T>,
Rhs: FixedPoint,
[src]
T: TryFrom<Rhs::T>,
Rhs: FixedPoint,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Rhs) -> Self::Output
[src]
impl<T: Clone + TimeInt> Clone for BitsPerSecond<T>
[src]
fn clone(&self) -> BitsPerSecond<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Copy + TimeInt> Copy for BitsPerSecond<T>
[src]
impl<T: Debug + TimeInt> Debug for BitsPerSecond<T>
[src]
impl<T: TimeInt> Display for BitsPerSecond<T>
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Just forwards the underlying integer to core::fmt::Display::fmt()
assert_eq!(format!("{}", Hertz(123_u32)), "123");
impl<T: Eq + TimeInt> Eq for BitsPerSecond<T>
[src]
impl<T: TimeInt> From<BitsPerSecond<T>> for Generic<T>
[src]
fn from(rate: BitsPerSecond<T>) -> Self
[src]
impl<T: Ord + TimeInt> Ord for BitsPerSecond<T>
[src]
fn cmp(&self, other: &BitsPerSecond<T>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: TimeInt, Rhs: Rate> PartialEq<Rhs> for BitsPerSecond<T> where
T: TryFrom<Rhs::T>,
Rhs: FixedPoint,
Rhs::T: TryFrom<T>,
[src]
T: TryFrom<Rhs::T>,
Rhs: FixedPoint,
Rhs::T: TryFrom<T>,
fn eq(&self, rhs: &Rhs) -> bool
[src]
assert_eq!(Hertz(123_000_u32), Kilohertz(123_u32)); assert_ne!(Hertz(123_001_u32), Kilohertz(123_u32));
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T: TimeInt, Rhs: Rate> PartialOrd<Rhs> for BitsPerSecond<T> where
T: TryFrom<Rhs::T>,
Rhs: FixedPoint,
Rhs::T: TryFrom<T>,
[src]
T: TryFrom<Rhs::T>,
Rhs: FixedPoint,
Rhs::T: TryFrom<T>,
fn partial_cmp(&self, rhs: &Rhs) -> Option<Ordering>
[src]
assert!(Hertz(2_001_u32) > Kilohertz(2_u32)); assert!(Hertz(1_999_u32) < Kilohertz(2_u32));
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T: TimeInt> Rate for BitsPerSecond<T>
[src]
fn try_into_generic<DestInt: TimeInt>(
self,
scaling_factor: Fraction
) -> Result<Generic<DestInt>, ConversionError> where
Self: FixedPoint,
DestInt: TryFrom<Self::T>,
[src]
self,
scaling_factor: Fraction
) -> Result<Generic<DestInt>, ConversionError> where
Self: FixedPoint,
DestInt: TryFrom<Self::T>,
fn try_from_duration<Duration: Duration>(
duration: Duration
) -> Result<Self, ConversionError> where
Duration: FixedPoint,
u32: TryFrom<Duration::T>,
Self: FixedPoint,
Self::T: TryFrom<Duration::T>,
[src]
duration: Duration
) -> Result<Self, ConversionError> where
Duration: FixedPoint,
u32: TryFrom<Duration::T>,
Self: FixedPoint,
Self::T: TryFrom<Duration::T>,
impl<T: TimeInt, Rhs: Rate> Rem<Rhs> for BitsPerSecond<T> where
T: TryFrom<Rhs::T>,
Rhs: FixedPoint,
[src]
T: TryFrom<Rhs::T>,
Rhs: FixedPoint,
type Output = Self
The resulting type after applying the %
operator.
fn rem(self, rhs: Rhs) -> Self::Output
[src]
Returns the remainder as the LHS type
assert_eq!(Hertz(2_037_u32) % Kilohertz(1_u32), Hertz(37_u32));
impl<T: TimeInt> StructuralEq for BitsPerSecond<T>
[src]
impl<T: TimeInt, Rhs: Rate> Sub<Rhs> for BitsPerSecond<T> where
T: TryFrom<Rhs::T>,
Rhs: FixedPoint,
[src]
T: TryFrom<Rhs::T>,
Rhs: FixedPoint,
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Rhs) -> Self::Output
[src]
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for BitsPerSecond<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]
DestInt: TryFrom<SourceInt>,
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(generic_rate: Generic<SourceInt>) -> Result<Self, Self::Error>
[src]
Construct a named Rate
from a Generic
Rate
Examples
assert_eq!( Hertz::<u64>::try_from(Generic::new(2_000_u32, Fraction::new(1,1_000))), Ok(Hertz(2_u64)) ); assert_eq!( Generic::new(2_000_u64, Fraction::new(1,1_000)).try_into(), Ok(Hertz(2_u64)) );
Errors
Failure will only occur if the provided value does not fit in the selected destination type.
ConversionError::Overflow
: The conversion of the scaling factor causes an
overflow.
assert_eq!(Hertz::<u32>::try_from(Generic::new(u32::MAX, Fraction::new(10,1))), Err(ConversionError::Overflow));
ConversionError::ConversionFailure
: The integer conversion to that of the
destination type fails.
assert_eq!(Hertz::<u32>::try_from(Generic::new(u32::MAX as u64 + 1, Fraction::new(1,1))), Err(ConversionError::ConversionFailure));
Auto Trait Implementations
impl<T> RefUnwindSafe for BitsPerSecond<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for BitsPerSecond<T> where
T: Send,
T: Send,
impl<T> Sync for BitsPerSecond<T> where
T: Sync,
T: Sync,
impl<T> Unpin for BitsPerSecond<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for BitsPerSecond<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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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>,