[−][src]Struct mag::Period
A measurement of period, duration or interval of time.
Period is a base quantity with a specific unit.
Operations
- Period
+
Period=>
Period - Period
-
Period=>
Period - Period
*
f64=>
Period - f64
*
Period=>
Period - f64
*
unit=>
Period - f64
/
Period=>
Frequency
Units must be the same for operations with two Period operands. The to method can be used for conversion.
use mag::time::{min, s}; let a = 15.0 * min; let b = 90.0 * s; assert_eq!(a.to_string(), "15 min"); assert_eq!((a + b.to()).to_string(), "16.5 min");
Fields
quantity: f64
Period quantity
Methods
impl<U> Period<U> where
U: Unit,
[src]
U: Unit,
pub fn new(quantity: f64) -> Self
[src]
Create a new period measurement
pub fn to<T: Unit>(self) -> Period<T>
[src]
Convert to specified units
Trait Implementations
impl<U: Clone> Clone for Period<U> where
U: Unit,
[src]
U: Unit,
impl<U: Copy> Copy for Period<U> where
U: Unit,
[src]
U: Unit,
impl<U: PartialEq> PartialEq<Period<U>> for Period<U> where
U: Unit,
[src]
U: Unit,
impl<U> Display for Period<U> where
U: Unit,
[src]
U: Unit,
impl<U: Debug> Debug for Period<U> where
U: Unit,
[src]
U: Unit,
impl<U> Div<f64> for Period<U> where
U: Unit,
[src]
U: Unit,
type Output = Self
The resulting type after applying the /
operator.
fn div(self, scalar: f64) -> Self::Output
[src]
impl<U> Div<Period<U>> for f64 where
U: Unit,
[src]
U: Unit,
type Output = Frequency<U>
The resulting type after applying the /
operator.
fn div(self, other: Period<U>) -> Self::Output
[src]
impl<L, T> Div<Period<T>> for Length<L> where
L: Unit,
T: Unit,
[src]
L: Unit,
T: Unit,
type Output = Speed<L, T>
The resulting type after applying the /
operator.
fn div(self, per: Period<T>) -> Self::Output
[src]
impl<U> Sub<Period<U>> for Period<U> where
U: Unit,
[src]
U: Unit,
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: Self) -> Self::Output
[src]
impl<U> Add<Period<U>> for Period<U> where
U: Unit,
[src]
U: Unit,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self::Output
[src]
impl<U> Mul<f64> for Period<U> where
U: Unit,
[src]
U: Unit,
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, scalar: f64) -> Self::Output
[src]
impl<U> Mul<Period<U>> for f64 where
U: Unit,
[src]
U: Unit,
type Output = Period<U>
The resulting type after applying the *
operator.
fn mul(self, other: Period<U>) -> Self::Output
[src]
impl<U> StructuralPartialEq for Period<U> where
U: Unit,
[src]
U: Unit,
Auto Trait Implementations
impl<U> Send for Period<U> where
U: Send,
U: Send,
impl<U> Sync for Period<U> where
U: Sync,
U: Sync,
impl<U> Unpin for Period<U> where
U: Unpin,
U: Unpin,
impl<U> UnwindSafe for Period<U> where
U: UnwindSafe,
U: UnwindSafe,
impl<U> RefUnwindSafe for Period<U> where
U: RefUnwindSafe,
U: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,