[−][src]Struct dwfv::signaldb::Timestamp
Representation of a point in time
Fields
value: i64
scale: Scale
Implementations
impl Timestamp
[src]
pub fn new(value: i64, scale: Scale) -> Timestamp
[src]
pub fn origin() -> Timestamp
[src]
pub fn auto_rescale(&mut self, max_value: i64) -> bool
[src]
pub fn derive(self, value: i64) -> Timestamp
[src]
Trait Implementations
impl Add<Timestamp> for Timestamp
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self
[src]
Add two timestamps
Example
use dwfv::signaldb::{Scale, Timestamp}; let a = Timestamp::new(21, Scale::Second); let b = Timestamp::new(21, Scale::Second); assert_eq!(a + b, Timestamp::new(42, Scale::Second)); let a = Timestamp::new(21, Scale::Second); let b = Timestamp::new(21, Scale::Microsecond); assert_eq!(a + b, Timestamp::new(21000021, Scale::Microsecond));
impl AddAssign<Timestamp> for Timestamp
[src]
fn add_assign(&mut self, other: Self)
[src]
impl Clone for Timestamp
[src]
impl Copy for Timestamp
[src]
impl Debug for Timestamp
[src]
impl Display for Timestamp
[src]
impl Div<Timestamp> for Timestamp
[src]
type Output = usize
The resulting type after applying the /
operator.
fn div(self, rhs: Self) -> usize
[src]
Divide two timestamps
Example
use dwfv::signaldb::{Scale, Timestamp}; let a = Timestamp::new(42, Scale::Millisecond); let b = Timestamp::new(21, Scale::Millisecond); assert_eq!(a / b, 2); let a = Timestamp::new(2, Scale::Second); let b = Timestamp::new(1, Scale::Microsecond); assert_eq!(a / b, 2000000);
impl Div<i64> for Timestamp
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: i64) -> Self
[src]
Divide a timestamp
Example
use dwfv::signaldb::{Scale, Timestamp}; let timestamp = Timestamp::new(42, Scale::Millisecond); assert_eq!(timestamp / 2, Timestamp::new(21, Scale::Millisecond)); let timestamp = Timestamp::new(1, Scale::Second); assert_eq!(timestamp / 2, Timestamp::new(500, Scale::Millisecond)); let timestamp = Timestamp::new(1, Scale::Femtosecond); assert_eq!(timestamp / 2, Timestamp::new(1, Scale::Femtosecond));
impl DivAssign<i64> for Timestamp
[src]
fn div_assign(&mut self, other: i64)
[src]
impl Eq for Timestamp
[src]
impl Mul<i64> for Timestamp
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: i64) -> Self
[src]
Multiply a timestamp
Example
use dwfv::signaldb::{Scale, Timestamp}; let timestamp = Timestamp::new(500, Scale::Millisecond); assert_eq!(timestamp * 2, Timestamp::new(1, Scale::Second));
impl MulAssign<i64> for Timestamp
[src]
fn mul_assign(&mut self, other: i64)
[src]
impl Ord for Timestamp
[src]
fn cmp(&self, other: &Timestamp) -> Ordering
[src]
Compare two timestamps
Example
use dwfv::signaldb::{Scale, Timestamp}; let a = Timestamp::new(1, Scale::Second); let b = Timestamp::new(1000, Scale::Millisecond); assert!(a == b); let a = Timestamp::new(1, Scale::Second); let b = Timestamp::new(999, Scale::Millisecond); assert!(a > b); let a = Timestamp::new(1, Scale::Second); let b = Timestamp::new(1001, Scale::Millisecond); assert!(a < b);
#[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 PartialEq<Timestamp> for Timestamp
[src]
impl PartialOrd<Timestamp> for Timestamp
[src]
fn partial_cmp(&self, other: &Timestamp) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for Timestamp
[src]
impl Sub<Timestamp> for Timestamp
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: Self) -> Self
[src]
Substract two timestamps
Example
use dwfv::signaldb::{Scale, Timestamp}; let a = Timestamp::new(21, Scale::Millisecond); let b = Timestamp::new(21, Scale::Millisecond); assert_eq!(a - b, Timestamp::new(0, Scale::Millisecond)); let a = Timestamp::new(21, Scale::Second); let b = Timestamp::new(21, Scale::Microsecond); assert_eq!(a - b, Timestamp::new(20999979, Scale::Microsecond));
impl SubAssign<Timestamp> for Timestamp
[src]
fn sub_assign(&mut self, other: Self)
[src]
Auto Trait Implementations
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnwindSafe for Timestamp
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> 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>,