Struct rtic_monotonic::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
fn to_generic<DestInt>(
self,
scaling_factor: Fraction
) -> Result<Generic<DestInt>, ConversionError> where
Self: FixedPoint,
DestInt: TimeInt + TryFrom<Self::T>,
fn to_generic<DestInt>(
self,
scaling_factor: Fraction
) -> Result<Generic<DestInt>, ConversionError> where
Self: FixedPoint,
DestInt: TimeInt + TryFrom<Self::T>,
Construct a Generic
Duration
from a named Duration
(eg.
Milliseconds
) Read more
fn to_rate<Rate>(&self) -> Result<Rate, ConversionError> where
Self: FixedPoint,
Rate: Rate + FixedPoint,
<Rate as FixedPoint>::T: TryFrom<Self::T>,
fn to_rate<Rate>(&self) -> Result<Rate, ConversionError> where
Self: FixedPoint,
Rate: Rate + FixedPoint,
<Rate as FixedPoint>::T: TryFrom<Self::T>,
See Comparisons
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
pub fn try_from(
generic_duration: Generic<SourceInt>
) -> Result<Milliseconds<DestInt>, <Milliseconds<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
pub fn try_from(
generic_duration: Generic<SourceInt>
) -> Result<Milliseconds<DestInt>, <Milliseconds<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
type Error = ConversionError
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>
pub fn try_from(
generic_duration: Generic<SourceInt>
) -> Result<Microseconds<DestInt>, <Microseconds<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
type Error = ConversionError
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>
pub fn try_from(
generic_duration: Generic<SourceInt>
) -> Result<Nanoseconds<DestInt>, <Nanoseconds<DestInt> as TryFrom<Generic<SourceInt>>>::Error>
type Error = ConversionError
type Error = ConversionError
The type returned in the event of a conversion error.