[][src]Struct dwfv::signaldb::Timestamp

pub struct Timestamp {
    pub value: i64,
    pub scale: Scale,
}

Representation of a point in time

Fields

value: i64scale: 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]

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]

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]

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);

impl PartialEq<Timestamp> for Timestamp[src]

impl PartialOrd<Timestamp> for Timestamp[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]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.