Struct drv8825::embedded_time::duration::Generic [−][src]
The Generic
Duration
type allows an arbitrary scaling factor to be used without having to
impl FixedPoint
.
The purpose of this type is to allow a simple Duration
object that can be defined at run-time.
It does this by replacing the const
scaling factor with a struct field.
Implementations
impl<T> Generic<T>
[src]
pub const fn new(integer: T, scaling_factor: Fraction) -> Generic<T>
[src]
Constructs a new fixed-point Generic
Duration
value
pub const fn integer(&self) -> &T
[src]
Returns the integer part
pub const fn scaling_factor(&self) -> &Fraction
[src]
Returns the scaling factor Fraction
part
Trait Implementations
impl<T> Clone for Generic<T> where
T: Clone,
[src]
T: Clone,
pub fn clone(&self) -> Generic<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Copy for Generic<T> where
T: Copy,
[src]
T: Copy,
impl<T> Debug for Generic<T> where
T: Debug,
[src]
T: Debug,
impl<T> Default for Generic<T> where
T: Default,
[src]
T: Default,
impl<T> Duration for Generic<T> where
T: TimeInt,
[src]
T: TimeInt,
pub fn to_generic<DestInt>(
self,
scaling_factor: Fraction
) -> Result<Generic<DestInt>, ConversionError> where
Self: FixedPoint,
DestInt: TimeInt + TryFrom<Self::T>,
[src]
self,
scaling_factor: Fraction
) -> Result<Generic<DestInt>, ConversionError> where
Self: FixedPoint,
DestInt: TimeInt + TryFrom<Self::T>,
pub fn to_rate<Rate>(&self) -> Result<Rate, ConversionError> where
Self: FixedPoint,
Rate: Rate + FixedPoint,
<Rate as FixedPoint>::T: TryFrom<Self::T>,
[src]
Self: FixedPoint,
Rate: Rate + FixedPoint,
<Rate as FixedPoint>::T: TryFrom<Self::T>,
impl<T> Eq for Generic<T> where
T: Eq,
[src]
T: Eq,
impl<T> From<Hours<T>> for Generic<T> where
T: TimeInt,
[src]
T: TimeInt,
impl<T> From<Microseconds<T>> for Generic<T> where
T: TimeInt,
[src]
T: TimeInt,
pub fn from(duration: Microseconds<T>) -> Generic<T>
[src]
impl<T> From<Milliseconds<T>> for Generic<T> where
T: TimeInt,
[src]
T: TimeInt,
pub fn from(duration: Milliseconds<T>) -> Generic<T>
[src]
impl<T> From<Minutes<T>> for Generic<T> where
T: TimeInt,
[src]
T: TimeInt,
impl<T> From<Nanoseconds<T>> for Generic<T> where
T: TimeInt,
[src]
T: TimeInt,
pub fn from(duration: Nanoseconds<T>) -> Generic<T>
[src]
impl<T> From<Seconds<T>> for Generic<T> where
T: TimeInt,
[src]
T: TimeInt,
impl<T> Hash for Generic<T> where
T: Hash,
[src]
T: Hash,
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> Ord for Generic<T> where
T: Ord,
[src]
T: Ord,
pub fn cmp(&self, other: &Generic<T>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T> PartialEq<Generic<T>> for Generic<T> where
T: PartialEq<T>,
[src]
T: PartialEq<T>,
impl<T> PartialOrd<Generic<T>> for Generic<T> where
T: PartialOrd<T>,
[src]
T: PartialOrd<T>,
pub fn partial_cmp(&self, other: &Generic<T>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T> StructuralEq for Generic<T>
[src]
impl<T> StructuralPartialEq for Generic<T>
[src]
impl<SourceInt, DestInt> TryFrom<Generic<SourceInt>> for Seconds<DestInt> where
DestInt: TimeInt + TryFrom<SourceInt>,
SourceInt: TimeInt,
[src]
DestInt: TimeInt + TryFrom<SourceInt>,
SourceInt: TimeInt,
type Error = ConversionError
The type returned in the event of a conversion error.
pub fn try_from(
generic_duration: Generic<SourceInt>
) -> Result<Seconds<DestInt>, <Seconds<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
[src]
generic_duration: Generic<SourceInt>
) -> Result<Seconds<DestInt>, <Seconds<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
impl<SourceInt, DestInt> TryFrom<Generic<SourceInt>> for Hours<DestInt> where
DestInt: TimeInt + TryFrom<SourceInt>,
SourceInt: TimeInt,
[src]
DestInt: TimeInt + TryFrom<SourceInt>,
SourceInt: TimeInt,
type Error = ConversionError
The type returned in the event of a conversion error.
pub fn try_from(
generic_duration: Generic<SourceInt>
) -> Result<Hours<DestInt>, <Hours<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
[src]
generic_duration: Generic<SourceInt>
) -> Result<Hours<DestInt>, <Hours<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
impl<SourceInt, DestInt> TryFrom<Generic<SourceInt>> for Nanoseconds<DestInt> where
DestInt: TimeInt + TryFrom<SourceInt>,
SourceInt: TimeInt,
[src]
DestInt: TimeInt + TryFrom<SourceInt>,
SourceInt: TimeInt,
type Error = ConversionError
The type returned in the event of a conversion error.
pub fn try_from(
generic_duration: Generic<SourceInt>
) -> Result<Nanoseconds<DestInt>, <Nanoseconds<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
[src]
generic_duration: Generic<SourceInt>
) -> Result<Nanoseconds<DestInt>, <Nanoseconds<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
impl<SourceInt, DestInt> TryFrom<Generic<SourceInt>> for Minutes<DestInt> where
DestInt: TimeInt + TryFrom<SourceInt>,
SourceInt: TimeInt,
[src]
DestInt: TimeInt + TryFrom<SourceInt>,
SourceInt: TimeInt,
type Error = ConversionError
The type returned in the event of a conversion error.
pub fn try_from(
generic_duration: Generic<SourceInt>
) -> Result<Minutes<DestInt>, <Minutes<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
[src]
generic_duration: Generic<SourceInt>
) -> Result<Minutes<DestInt>, <Minutes<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
impl<SourceInt, DestInt> TryFrom<Generic<SourceInt>> for Microseconds<DestInt> where
DestInt: TimeInt + TryFrom<SourceInt>,
SourceInt: TimeInt,
[src]
DestInt: TimeInt + TryFrom<SourceInt>,
SourceInt: TimeInt,
type Error = ConversionError
The type returned in the event of a conversion error.
pub fn try_from(
generic_duration: Generic<SourceInt>
) -> Result<Microseconds<DestInt>, <Microseconds<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
[src]
generic_duration: Generic<SourceInt>
) -> Result<Microseconds<DestInt>, <Microseconds<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
impl<SourceInt, DestInt> TryFrom<Generic<SourceInt>> for Milliseconds<DestInt> where
DestInt: TimeInt + TryFrom<SourceInt>,
SourceInt: TimeInt,
[src]
DestInt: TimeInt + TryFrom<SourceInt>,
SourceInt: TimeInt,
type Error = ConversionError
The type returned in the event of a conversion error.
pub fn try_from(
generic_duration: Generic<SourceInt>
) -> Result<Milliseconds<DestInt>, <Milliseconds<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
[src]
generic_duration: Generic<SourceInt>
) -> Result<Milliseconds<DestInt>, <Milliseconds<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
Auto Trait Implementations
impl<T> Send for Generic<T> where
T: Send,
T: Send,
impl<T> Sync for Generic<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Generic<T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Az for T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedAs for T
[src]
pub fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
[src]
T: CheckedCast<Dst>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
[src]
Dst: LosslessTryFrom<Src>,
pub fn lossless_try_into(self) -> Option<Dst>
[src]
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
[src]
Dst: LossyFrom<Src>,
pub fn lossy_into(self) -> Dst
[src]
impl<T> OverflowingAs for T
[src]
pub fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
[src]
T: OverflowingCast<Dst>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> SaturatingAs for T
[src]
pub fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
[src]
T: SaturatingCast<Dst>,
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.
pub 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> UnwrappedAs for T
[src]
pub fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
[src]
T: UnwrappedCast<Dst>,
impl<T> WrappingAs for T
[src]
pub fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
[src]
T: WrappingCast<Dst>,