Struct embedded_time::duration::Generic [−][src]
pub struct Generic<T> { /* fields omitted */ }
Expand description
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
Trait Implementations
impl<T: TimeInt> Duration for Generic<T>
[src]
impl<T: TimeInt> Duration for Generic<T>
[src]fn to_generic<DestInt: TimeInt>(
self,
scaling_factor: Fraction
) -> Result<Generic<DestInt>, ConversionError> where
Self: FixedPoint,
DestInt: TryFrom<Self::T>,
[src]
fn to_generic<DestInt: TimeInt>(
self,
scaling_factor: Fraction
) -> Result<Generic<DestInt>, ConversionError> where
Self: FixedPoint,
DestInt: TryFrom<Self::T>,
[src]Construct a Generic
Duration
from a named Duration
(eg.
Milliseconds
) Read more
fn to_rate<Rate: Rate>(&self) -> Result<Rate, ConversionError> where
Rate: FixedPoint,
Self: FixedPoint,
Rate::T: TryFrom<Self::T>,
[src]
fn to_rate<Rate: Rate>(&self) -> Result<Rate, ConversionError> where
Rate: FixedPoint,
Self: FixedPoint,
Rate::T: TryFrom<Self::T>,
[src]impl<T: TimeInt> From<Microseconds<T>> for Generic<T>
[src]
impl<T: TimeInt> From<Microseconds<T>> for Generic<T>
[src]fn from(duration: Microseconds<T>) -> Self
[src]
fn from(duration: Microseconds<T>) -> Self
[src]impl<T: TimeInt> From<Milliseconds<T>> for Generic<T>
[src]
impl<T: TimeInt> From<Milliseconds<T>> for Generic<T>
[src]fn from(duration: Milliseconds<T>) -> Self
[src]
fn from(duration: Milliseconds<T>) -> Self
[src]impl<T: TimeInt> From<Nanoseconds<T>> for Generic<T>
[src]
impl<T: TimeInt> From<Nanoseconds<T>> for Generic<T>
[src]fn from(duration: Nanoseconds<T>) -> Self
[src]
fn from(duration: Nanoseconds<T>) -> Self
[src]impl<T: TimeInt> Ord for Generic<T>
[src]
impl<T: TimeInt> Ord for Generic<T>
[src]impl<T: TimeInt> PartialOrd<Generic<T>> for Generic<T>
[src]
impl<T: TimeInt> PartialOrd<Generic<T>> for Generic<T>
[src]fn partial_cmp(&self, rhs: &Generic<T>) -> Option<Ordering>
[src]
fn partial_cmp(&self, rhs: &Generic<T>) -> Option<Ordering>
[src]See Comparisons
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Hours<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Hours<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Minutes<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Minutes<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Seconds<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Seconds<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Milliseconds<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Milliseconds<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Microseconds<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Microseconds<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Nanoseconds<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Nanoseconds<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]impl<T: Copy> Copy for Generic<T>
[src]
impl<T: TimeInt> Eq for Generic<T>
[src]
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,