[−][src]Struct embedded_time::duration::Generic
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) -> Self
[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> Clone for Generic<T>
[src]
fn clone(&self) -> Generic<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Copy> Copy for Generic<T>
[src]
impl<T: Debug> Debug for Generic<T>
[src]
impl<T: Default> Default 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]
self,
scaling_factor: Fraction
) -> Result<Generic<DestInt>, ConversionError> where
Self: FixedPoint,
DestInt: TryFrom<Self::T>,
fn to_rate<Rate: Rate>(&self) -> Result<Rate, ConversionError> where
Rate: FixedPoint,
Self: FixedPoint,
Rate::T: TryFrom<Self::T>,
[src]
Rate: FixedPoint,
Self: FixedPoint,
Rate::T: TryFrom<Self::T>,
impl<T: Eq> Eq for Generic<T>
[src]
impl<T: TimeInt> From<Hours<T>> for Generic<T>
[src]
impl<T: TimeInt> From<Microseconds<T>> for Generic<T>
[src]
fn from(duration: Microseconds<T>) -> Self
[src]
impl<T: TimeInt> From<Milliseconds<T>> for Generic<T>
[src]
fn from(duration: Milliseconds<T>) -> Self
[src]
impl<T: TimeInt> From<Minutes<T>> for Generic<T>
[src]
impl<T: TimeInt> From<Nanoseconds<T>> for Generic<T>
[src]
fn from(duration: Nanoseconds<T>) -> Self
[src]
impl<T: TimeInt> From<Seconds<T>> for Generic<T>
[src]
impl<T: Hash> Hash for Generic<T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Ord> Ord for Generic<T>
[src]
fn cmp(&self, other: &Generic<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: PartialEq> PartialEq<Generic<T>> for Generic<T>
[src]
impl<T: PartialOrd> PartialOrd<Generic<T>> for Generic<T>
[src]
fn partial_cmp(&self, other: &Generic<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &Generic<T>) -> bool
[src]
fn le(&self, other: &Generic<T>) -> bool
[src]
fn gt(&self, other: &Generic<T>) -> bool
[src]
fn ge(&self, other: &Generic<T>) -> bool
[src]
impl<T> StructuralEq for Generic<T>
[src]
impl<T> StructuralPartialEq for Generic<T>
[src]
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Hours<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_duration: Generic<SourceInt>) -> Result<Self, Self::Error>
[src]
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Minutes<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_duration: Generic<SourceInt>) -> Result<Self, Self::Error>
[src]
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Seconds<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_duration: Generic<SourceInt>) -> Result<Self, Self::Error>
[src]
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Milliseconds<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_duration: Generic<SourceInt>) -> Result<Self, Self::Error>
[src]
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Microseconds<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_duration: Generic<SourceInt>) -> Result<Self, Self::Error>
[src]
impl<SourceInt: TimeInt, DestInt: TimeInt> TryFrom<Generic<SourceInt>> for Nanoseconds<DestInt> where
DestInt: TryFrom<SourceInt>,
[src]
DestInt: TryFrom<SourceInt>,
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> 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>,