summaryrefslogtreecommitdiff
path: root/src/result.rs
blob: f5d8598b856ba9c0a743282d43628dc9d5fcadad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use serde::Serialize;

#[derive(Debug, Default, Serialize)]
pub struct Result {
    measurements: Vec<Measurement>,
}

#[derive(Debug, Serialize)]
pub struct Measurement {
    op: Operation,
    ms: u128,
}

#[derive(Debug, Clone, Copy, Serialize)]
pub enum Operation {
    Backup,
    Restore,
}

impl Result {
    pub fn push(&mut self, m: Measurement) {
        self.measurements.push(m);
    }
}

impl Measurement {
    pub fn new(op: Operation, ms: u128) -> Self {
        Self { op, ms }
    }
}