Struct TimeStamp

Source
pub struct TimeStamp {
    pub amount: f64,
}

Fields§

§amount: f64

Implementations§

Source§

impl TimeStamp

Source

pub fn new(amount: f64) -> Self

Examples found in repository?
examples/perf.rs (line 25)
15fn insertions(db: &mut TsDb) {
16    let num_insertions = 1_000_000;
17    println!(
18        "Created database, now inserting {} data points into a signal.",
19        num_insertions
20    );
21
22    db.new_trace("fu");
23    let t1 = Instant::now();
24    for i in 0..num_insertions {
25        let ts = TimeStamp::new(i as f64);
26        let sample = Sample::new(i as f64);
27        let observation = Observation::new(ts, sample);
28        db.add_value("fu", observation);
29    }
30    let t2 = Instant::now();
31    let time_delta = t2 - t1;
32    let time_delta = time_delta.as_secs_f64();
33
34    println!(
35        "Inserted {} points in {} seconds.",
36        num_insertions, time_delta
37    );
38    let rate = num_insertions as f64 / time_delta;
39    println!("That means {} mega-points per second.", rate / 1.0e6);
40}
41
42fn do_query(db: &TsDb) {
43    // Query the data
44    println!("Querying the database!");
45
46    let query = Query::create()
47        .start(TimeStamp::new(0.0))
48        .end(TimeStamp::new(1000.0))
49        .build();
50    let result = db.query("fu", query);
51
52    println!("Got result: {:?}", result.query);
53    println!("Num result: {:?}", result.len());
54    // let raw_samples = result.into_vec();
55    // println!("Raw samples: {}", raw_samples.len());
56}
Source

pub fn from_seconds(seconds: isize) -> Self

Trait Implementations§

Source§

impl Clone for TimeStamp

Source§

fn clone(&self) -> TimeStamp

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TimeStamp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TimeStamp

Source§

fn eq(&self, other: &TimeStamp) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for TimeStamp

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl TimeModifiers for TimeStamp

Source§

fn add_millis(&self, amount: isize) -> Self

Source§

fn add_nanos(&self, amount: isize) -> Self

Source§

impl StructuralPartialEq for TimeStamp

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.